🗃️ Update auth factor db

This commit is contained in:
LittleSheep 2025-06-03 23:39:55 +08:00
parent c4f6798fd0
commit e62b2cc5ff
3 changed files with 3489 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,61 @@
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class BetterAuthFactor : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Dictionary<string, object>>(
name: "config",
table: "account_auth_factors",
type: "jsonb",
nullable: true);
migrationBuilder.AddColumn<Instant>(
name: "enabled_at",
table: "account_auth_factors",
type: "timestamp with time zone",
nullable: true);
migrationBuilder.AddColumn<Instant>(
name: "expired_at",
table: "account_auth_factors",
type: "timestamp with time zone",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "trustworthy",
table: "account_auth_factors",
type: "integer",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "config",
table: "account_auth_factors");
migrationBuilder.DropColumn(
name: "enabled_at",
table: "account_auth_factors");
migrationBuilder.DropColumn(
name: "expired_at",
table: "account_auth_factors");
migrationBuilder.DropColumn(
name: "trustworthy",
table: "account_auth_factors");
}
}
}

View File

@ -96,6 +96,10 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Dictionary<string, object>>("Config")
.HasColumnType("jsonb")
.HasColumnName("config");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("created_at"); .HasColumnName("created_at");
@ -104,11 +108,23 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at"); .HasColumnName("deleted_at");
b.Property<Instant?>("EnabledAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("enabled_at");
b.Property<Instant?>("ExpiredAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("expired_at");
b.Property<string>("Secret") b.Property<string>("Secret")
.HasMaxLength(8196) .HasMaxLength(8196)
.HasColumnType("character varying(8196)") .HasColumnType("character varying(8196)")
.HasColumnName("secret"); .HasColumnName("secret");
b.Property<int>("Trustworthy")
.HasColumnType("integer")
.HasColumnName("trustworthy");
b.Property<int>("Type") b.Property<int>("Type")
.HasColumnType("integer") .HasColumnType("integer")
.HasColumnName("type"); .HasColumnName("type");
@ -515,9 +531,9 @@ namespace DysonNetwork.Sphere.Migrations
b.HasIndex("AccountId") b.HasIndex("AccountId")
.HasDatabaseName("ix_notification_push_subscriptions_account_id"); .HasDatabaseName("ix_notification_push_subscriptions_account_id");
b.HasIndex("DeviceToken", "DeviceId") b.HasIndex("DeviceToken", "DeviceId", "AccountId")
.IsUnique() .IsUnique()
.HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id"); .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco");
b.ToTable("notification_push_subscriptions", (string)null); b.ToTable("notification_push_subscriptions", (string)null);
}); });