Files
API/TOOHUCardAPI/Migrations/20211031004851_cardlevel.cs

57 lines
2.0 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
namespace TOOHUCardAPI.Migrations
{
public partial class cardlevel : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "LevelList",
table: "Users");
migrationBuilder.CreateTable(
name: "CardLevel",
columns: table => new
{
UserSteamId = table.Column<string>(type: "TEXT", nullable: false),
CardItemCode = table.Column<string>(type: "TEXT", nullable: false),
Level = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CardLevel", x => new { x.UserSteamId, x.CardItemCode });
table.ForeignKey(
name: "FK_CardLevel_Cards_CardItemCode",
column: x => x.CardItemCode,
principalTable: "Cards",
principalColumn: "ItemCode",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CardLevel_Users_UserSteamId",
column: x => x.UserSteamId,
principalTable: "Users",
principalColumn: "SteamId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CardLevel_CardItemCode",
table: "CardLevel",
column: "CardItemCode");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CardLevel");
migrationBuilder.AddColumn<string>(
name: "LevelList",
table: "Users",
type: "TEXT",
nullable: true);
}
}
}