🗃️ Add rewind point migration

This commit is contained in:
2025-12-25 22:51:59 +08:00
parent 1af11b2a99
commit 43d89299c3
3 changed files with 3053 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Pass.Migrations
{
/// <inheritdoc />
public partial class AddRewindPoint : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "rewind_points",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
year = table.Column<int>(type: "integer", nullable: false),
schema_version = table.Column<int>(type: "integer", nullable: false),
data = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: false),
account_id = table.Column<Guid>(type: "uuid", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_rewind_points", x => x.id);
table.ForeignKey(
name: "fk_rewind_points_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_rewind_points_account_id",
table: "rewind_points",
column: "account_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "rewind_points");
}
}
}

View File

@@ -1700,6 +1700,51 @@ namespace DysonNetwork.Pass.Migrations
b.ToTable("realm_members", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnRewindPoint", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<Guid>("AccountId")
.HasColumnType("uuid")
.HasColumnName("account_id");
b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property<Dictionary<string, object>>("Data")
.IsRequired()
.HasColumnType("jsonb")
.HasColumnName("data");
b.Property<Instant?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property<int>("SchemaVersion")
.HasColumnType("integer")
.HasColumnName("schema_version");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property<int>("Year")
.HasColumnType("integer")
.HasColumnName("year");
b.HasKey("Id")
.HasName("pk_rewind_points");
b.HasIndex("AccountId")
.HasDatabaseName("ix_rewind_points_account_id");
b.ToTable("rewind_points", (string)null);
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnSocialCreditRecord", b =>
{
b.Property<Guid>("Id")
@@ -2667,6 +2712,18 @@ namespace DysonNetwork.Pass.Migrations
b.Navigation("Realm");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnRewindPoint", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnAccount", "Account")
.WithMany()
.HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_rewind_points_accounts_account_id");
b.Navigation("Account");
});
modelBuilder.Entity("DysonNetwork.Shared.Models.SnSocialCreditRecord", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnAccount", "Account")