Swarm/DysonNetwork.Sphere/Migrations/20250507175552_AddAccountCheckIn.cs
2025-05-08 01:56:35 +08:00

54 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using DysonNetwork.Sphere.Account;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddAccountCheckIn : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "account_check_in_results",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
level = table.Column<int>(type: "integer", nullable: false),
tips = table.Column<ICollection<FortuneTip>>(type: "jsonb", nullable: false),
account_id = table.Column<long>(type: "bigint", 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_account_check_in_results", x => x.id);
table.ForeignKey(
name: "fk_account_check_in_results_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_account_check_in_results_account_id",
table: "account_check_in_results",
column: "account_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "account_check_in_results");
}
}
}