Files
2024-03-29 17:34:59 +08:00

116 lines
4.5 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddUnlocks : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<long>(
name: "MatchId",
table: "OnlineMatches",
type: "INTEGER",
nullable: false,
oldClrType: typeof(long),
oldType: "INTEGER")
.OldAnnotation("Sqlite:Autoincrement", true);
migrationBuilder.CreateTable(
name: "Coins",
columns: table => new
{
CardId = table.Column<long>(type: "INTEGER", nullable: false),
Count = table.Column<int>(type: "INTEGER", nullable: false),
CreateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdateTime = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Coins", x => x.CardId);
table.ForeignKey(
name: "FK_Coins_card_main_CardId",
column: x => x.CardId,
principalTable: "card_main",
principalColumn: "card_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Items",
columns: table => new
{
ItemId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
CardId = table.Column<long>(type: "INTEGER", nullable: false),
Count = table.Column<int>(type: "INTEGER", nullable: false),
CreateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdateTime = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Items", x => x.ItemId);
table.ForeignKey(
name: "FK_Items_card_main_CardId",
column: x => x.CardId,
principalTable: "card_main",
principalColumn: "card_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Unlocks",
columns: table => new
{
CardId = table.Column<long>(type: "INTEGER", nullable: false),
UnlockItemId = table.Column<int>(type: "INTEGER", nullable: false),
UnlockType = table.Column<int>(type: "INTEGER", nullable: false),
IsNew = table.Column<bool>(type: "INTEGER", nullable: false),
CreateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdateTime = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Unlocks", x => new { x.CardId, x.UnlockItemId, x.UnlockType });
table.ForeignKey(
name: "FK_Unlocks_card_main_CardId",
column: x => x.CardId,
principalTable: "card_main",
principalColumn: "card_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Items_CardId",
table: "Items",
column: "CardId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Coins");
migrationBuilder.DropTable(
name: "Items");
migrationBuilder.DropTable(
name: "Unlocks");
migrationBuilder.AlterColumn<long>(
name: "MatchId",
table: "OnlineMatches",
type: "INTEGER",
nullable: false,
oldClrType: typeof(long),
oldType: "INTEGER")
.Annotation("Sqlite:Autoincrement", true);
}
}
}