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(type: "TEXT", nullable: false), CardItemCode = table.Column(type: "TEXT", nullable: false), Level = table.Column(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( name: "LevelList", table: "Users", type: "TEXT", nullable: true); } } }