Pushed up to docker

This commit is contained in:
2021-11-02 09:16:15 -04:00
parent a3ec5f6169
commit 873f126aac
10 changed files with 452 additions and 846 deletions

View File

@@ -0,0 +1,333 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace TOOHUCardAPI.Migrations
{
public partial class movingtopostgres : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
SteamId = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
MaxWave = table.Column<int>(type: "integer", nullable: false),
MaxTeamWave = table.Column<int>(type: "integer", nullable: false),
PetLevel = table.Column<int>(type: "integer", nullable: false),
EndTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
KeyTotal = table.Column<int>(type: "integer", nullable: false),
KeyUseCount = table.Column<int>(type: "integer", nullable: false),
KeySaveDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Vip = table.Column<bool>(type: "boolean", nullable: false),
Ban = table.Column<bool>(type: "boolean", nullable: false),
Point = table.Column<int>(type: "integer", nullable: false),
LastFirstWin = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
LastDailyLoginBonus = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
PowerMaxTotal = table.Column<int>(type: "integer", nullable: false),
PetModel = table.Column<string>(type: "text", nullable: true),
PetEffect = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.SteamId);
});
migrationBuilder.CreateTable(
name: "EncodedCardGroup",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
GroupKey = table.Column<string>(type: "text", nullable: true),
EncodedString = table.Column<string>(type: "text", nullable: true),
UserSteamId = table.Column<long>(type: "bigint", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EncodedCardGroup", x => x.Id);
table.ForeignKey(
name: "FK_EncodedCardGroup_Users_UserSteamId",
column: x => x.UserSteamId,
principalTable: "Users",
principalColumn: "SteamId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "RankEntries",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RankType = table.Column<int>(type: "integer", nullable: false),
UserSteamId = table.Column<long>(type: "bigint", nullable: true),
Version = table.Column<string>(type: "text", nullable: true),
Wave = table.Column<int>(type: "integer", nullable: false),
Damage = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RankEntries", x => x.Id);
table.ForeignKey(
name: "FK_RankEntries_Users_UserSteamId",
column: x => x.UserSteamId,
principalTable: "Users",
principalColumn: "SteamId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "CardLevel",
columns: table => new
{
UserSteamId = table.Column<long>(type: "bigint", 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_Users_UserSteamId",
column: x => x.UserSteamId,
principalTable: "Users",
principalColumn: "SteamId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "RankTowerEntry",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
BaseUnitItemCode = table.Column<string>(type: "text", nullable: true),
Star = table.Column<int>(type: "integer", nullable: false),
Damage = table.Column<int>(type: "integer", nullable: false),
Attack = table.Column<int>(type: "integer", nullable: false),
Power = table.Column<int>(type: "integer", nullable: false),
RankEntryId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RankTowerEntry", x => x.Id);
table.ForeignKey(
name: "FK_RankTowerEntry_RankEntries_RankEntryId",
column: x => x.RankEntryId,
principalTable: "RankEntries",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Cards",
columns: table => new
{
ItemCode = table.Column<string>(type: "text", nullable: false),
CardName = table.Column<string>(type: "text", nullable: true),
Quality = table.Column<int>(type: "integer", nullable: false),
HasVoice = table.Column<bool>(type: "boolean", nullable: false),
HasPortrait = table.Column<bool>(type: "boolean", nullable: false),
RankTowerEntryId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Cards", x => x.ItemCode);
table.ForeignKey(
name: "FK_Cards_RankTowerEntry_RankTowerEntryId",
column: x => x.RankTowerEntryId,
principalTable: "RankTowerEntry",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.InsertData(
table: "Cards",
columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality", "RankTowerEntryId" },
values: new object[,]
{
{ "item_0026", "rin", true, true, 3, null },
{ "item_0017", "iku", true, false, 2, null },
{ "item_0092", "medicine", true, true, 2, null },
{ "item_0064", "shikieiki", true, false, 4, null },
{ "item_1006", "BonusEgg", false, false, 4, null },
{ "item_0005", "shanghainingyou", false, false, 1, null },
{ "item_0093", "kyouko", true, true, 2, null },
{ "item_0024", "yuyuko", true, true, 3, null },
{ "item_2013", "item_2013", false, false, 4, null },
{ "item_0058", "luna", true, true, 2, null },
{ "item_0047", "kanako", true, true, 4, null },
{ "item_0068", "komachi", true, false, 4, null },
{ "item_0027", "utsuho", true, false, 3, null },
{ "item_0097", "yoshika", true, false, 2, null },
{ "item_1013", "BonusEgg", false, false, 3, null },
{ "item_2001", "item_2001", false, false, 3, null },
{ "item_0095", "futo", true, false, 3, null },
{ "item_0057", "sunny", true, true, 2, null },
{ "item_0006", "hourainingyou", false, false, 1, null },
{ "item_0056", "star", true, true, 2, null },
{ "item_2003", "item_2003", false, false, 3, null },
{ "item_2004", "item_2004", false, false, 2, null },
{ "item_0049", "minamitsu", true, true, 3, null },
{ "item_0023", "reisen", true, true, 3, null },
{ "item_0013", "lunasa", true, true, 2, null },
{ "item_0052", "miko", true, true, 4, null },
{ "item_0091", "hina", true, false, 2, null },
{ "item_0040", "mokou", true, true, 3, null },
{ "item_0021", "patchouli", true, true, 3, null },
{ "item_0094", "soga", true, true, 3, null },
{ "item_0031", "koishi", true, true, 4, null },
{ "item_0012", "lyrica", true, true, 2, null },
{ "item_0008", "maidyousei", false, false, 1, null },
{ "item_0053", "kokoro", true, true, 3, null },
{ "item_0016", "satori", true, true, 2, null },
{ "item_0048", "suwako", true, false, 3, null },
{ "item_0035", "yuuka", true, true, 4, null },
{ "item_0037", "ran", true, true, 3, null },
{ "item_0039", "eirin", true, true, 4, null },
{ "item_0041", "kaguya", true, true, 3, null },
{ "item_0033", "koakuma", true, true, 2, null },
{ "item_0032", "flandre", true, true, 4, null },
{ "item_0054", "yuugi", true, true, 3, null },
{ "item_0059", "alice", true, true, 3, null },
{ "item_0060", "wriggle", true, false, 2, null },
{ "item_1005", "BonusEgg", false, false, 3, null },
{ "item_0001", "lily", true, false, 2, null },
{ "item_0062", "inaba", true, false, 2, null },
{ "item_0010", "kogasa", true, true, 2, null },
{ "item_2012", "item_2012", false, false, 4, null },
{ "item_0088", "sizuha", true, true, 2, null },
{ "item_1004", "BonusEgg", false, false, 2, null },
{ "item_0020", "tenshi", true, false, 3, null },
{ "item_2005", "item_2005", false, false, 2, null },
{ "item_0046", "sanae", true, false, 3, null },
{ "item_2022", "item_2022", false, false, 3, null },
{ "item_0003", "minoriko", true, true, 2, null },
{ "item_0022", "sakuya", true, true, 3, null },
{ "item_1003", "BonusEgg", false, false, 1, null },
{ "item_0011", "letty", true, true, 2, null },
{ "item_0044", "momiji", true, true, 2, null },
{ "item_0050", "nue", true, false, 3, null },
{ "item_0075", "clownpiece", true, false, 3, null },
{ "item_0019", "marisa", true, true, 3, null },
{ "item_0045", "kagerou", true, false, 3, null },
{ "item_0028", "reimu", true, true, 4, null },
{ "item_0030", "remilia", true, false, 4, null },
{ "item_0015", "rumia", true, true, 2, null },
{ "item_1011", "BonusEgg", false, false, 1, null },
{ "item_0042", "aya", true, false, 3, null },
{ "item_0069", "toramaru", true, false, 2, null },
{ "item_0061", "keine", true, false, 3, null },
{ "item_0002", "nazrin", true, true, 2, null },
{ "item_0055", "suika", true, true, 3, null },
{ "item_2002", "item_2002", false, false, 4, null },
{ "item_0007", "hanadayousei", false, false, 1, null },
{ "item_0014", "merlin", true, true, 2, null },
{ "item_0043", "hatate", true, true, 2, null },
{ "item_2020", "item_2020", false, false, 4, null },
{ "item_2017", "item_2017", false, false, 3, null },
{ "item_2016", "item_2016", false, false, 3, null },
{ "item_2006", "item_2006", false, false, 2, null },
{ "item_2009", "item_2009", false, false, 3, null },
{ "item_0018", "mystia", true, true, 2, null },
{ "item_0036", "yukari", true, false, 4, null },
{ "item_2008", "item_2008", false, false, 2, null },
{ "item_2010", "item_2010", false, false, 3, null },
{ "item_2011", "item_2011", false, false, 3, null },
{ "item_0034", "meirin", true, false, 2, null },
{ "item_0096", "seiga", true, false, 3, null },
{ "item_0004", "mugiyousei", false, false, 1, null },
{ "item_0025", "youmu", true, true, 3, null },
{ "item_2007", "item_2007", false, false, 2, null },
{ "item_0063", "kisume", true, false, 2, null },
{ "item_0073", "junko", true, false, 4, null },
{ "item_0029", "daiyousei", true, true, 4, null },
{ "item_1012", "BonusEgg", false, false, 2, null },
{ "item_0051", "byakuren", true, false, 4, null },
{ "item_0080", "shinki", true, false, 4, null },
{ "item_0074", "hecatia", true, false, 4, null },
{ "item_0038", "chen", true, false, 2, null },
{ "item_0009", "cirno", true, false, 2, null },
{ "item_2014", "item_2014", false, false, 4, null },
{ "item_2015", "item_2015", false, false, 3, null },
{ "item_2019", "item_2019", false, false, 2, null },
{ "item_2018", "item_2018", false, false, 2, null },
{ "item_1014", "BonusEgg", false, false, 4, null }
});
migrationBuilder.CreateIndex(
name: "IX_CardLevel_CardItemCode",
table: "CardLevel",
column: "CardItemCode");
migrationBuilder.CreateIndex(
name: "IX_Cards_RankTowerEntryId",
table: "Cards",
column: "RankTowerEntryId");
migrationBuilder.CreateIndex(
name: "IX_EncodedCardGroup_UserSteamId",
table: "EncodedCardGroup",
column: "UserSteamId");
migrationBuilder.CreateIndex(
name: "IX_RankEntries_UserSteamId",
table: "RankEntries",
column: "UserSteamId");
migrationBuilder.CreateIndex(
name: "IX_RankTowerEntry_BaseUnitItemCode",
table: "RankTowerEntry",
column: "BaseUnitItemCode");
migrationBuilder.CreateIndex(
name: "IX_RankTowerEntry_RankEntryId",
table: "RankTowerEntry",
column: "RankEntryId");
migrationBuilder.AddForeignKey(
name: "FK_CardLevel_Cards_CardItemCode",
table: "CardLevel",
column: "CardItemCode",
principalTable: "Cards",
principalColumn: "ItemCode",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RankTowerEntry_Cards_BaseUnitItemCode",
table: "RankTowerEntry",
column: "BaseUnitItemCode",
principalTable: "Cards",
principalColumn: "ItemCode",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_RankTowerEntry_Cards_BaseUnitItemCode",
table: "RankTowerEntry");
migrationBuilder.DropTable(
name: "CardLevel");
migrationBuilder.DropTable(
name: "EncodedCardGroup");
migrationBuilder.DropTable(
name: "Cards");
migrationBuilder.DropTable(
name: "RankTowerEntry");
migrationBuilder.DropTable(
name: "RankEntries");
migrationBuilder.DropTable(
name: "Users");
}
}
}