Files
jizhi/backend/MiaoJiZhang.Infrastructure/Persistence/Migrations/20260721120000_AccountClosureAndCategoryIcons.cs
T
2026-07-24 23:11:20 +08:00

69 lines
2.1 KiB
C#

using MiaoJiZhang.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MiaoJiZhang.Infrastructure.Persistence.Migrations;
[DbContext(typeof(AppDbContext))]
[Migration("20260721120000_AccountClosureAndCategoryIcons")]
public partial class AccountClosureAndCategoryIcons : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "AccountClosureRequestedAt",
table: "Users",
type: "datetime(6)",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "AccountClosureScheduledAt",
table: "Users",
type: "datetime(6)",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "AuthVersion",
table: "Users",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateIndex(
name: "IX_Users_AccountClosureScheduledAt",
table: "Users",
column: "AccountClosureScheduledAt");
migrationBuilder.Sql(
"UPDATE Categories SET IconKey = 'cart' WHERE IconKey = 'shopping';");
migrationBuilder.Sql(
"UPDATE Categories SET IconKey = 'metro' WHERE IconKey = 'transport';");
migrationBuilder.Sql(
"UPDATE Categories SET IconKey = 'house' WHERE IconKey = 'home';");
migrationBuilder.Sql(
"UPDATE Categories SET IconKey = 'money' WHERE IconKey = 'salary';");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Users_AccountClosureScheduledAt",
table: "Users");
migrationBuilder.DropColumn(
name: "AccountClosureRequestedAt",
table: "Users");
migrationBuilder.DropColumn(
name: "AccountClosureScheduledAt",
table: "Users");
migrationBuilder.DropColumn(
name: "AuthVersion",
table: "Users");
}
}