🗃️ 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

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");
}
}
}