using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SystemRevivalServer.Migrations { /// public partial class LootTables : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "dungeon_loot_tables", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), MinTier = table.Column(type: "int", nullable: false), MaxTier = table.Column(type: "int", nullable: false), DropChanceMultiplier = table.Column(type: "float", nullable: false), MinDrops = table.Column(type: "int", nullable: false), MaxDrops = table.Column(type: "int", nullable: false), GuaranteedDrop = table.Column(type: "tinyint(1)", nullable: false), IsEnabled = table.Column(type: "tinyint(1)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_dungeon_loot_tables", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "dungeon_loot_table_entries", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), LootTableId = table.Column(type: "int", nullable: false), ItemDefinitionId = table.Column(type: "int", nullable: false), DropChance = table.Column(type: "float", nullable: false), MinQuantity = table.Column(type: "int", nullable: false), MaxQuantity = table.Column(type: "int", nullable: false), Weight = table.Column(type: "int", nullable: false), Guaranteed = table.Column(type: "tinyint(1)", nullable: false), DropChancePerTier = table.Column(type: "float", nullable: false), MaxDropChance = table.Column(type: "float", nullable: false) }, constraints: table => { table.PrimaryKey("PK_dungeon_loot_table_entries", x => x.Id); table.ForeignKey( name: "FK_dungeon_loot_table_entries_dungeon_item_definitions_ItemDefi~", column: x => x.ItemDefinitionId, principalTable: "dungeon_item_definitions", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_dungeon_loot_table_entries_dungeon_loot_tables_LootTableId", column: x => x.LootTableId, principalTable: "dungeon_loot_tables", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "dungeon_mob_loot_tables", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), MobDefinitionId = table.Column(type: "int", nullable: false), LootTableId = table.Column(type: "int", nullable: false), Priority = table.Column(type: "int", nullable: false), RollChance = table.Column(type: "float", nullable: false) }, constraints: table => { table.PrimaryKey("PK_dungeon_mob_loot_tables", x => x.Id); table.ForeignKey( name: "FK_dungeon_mob_loot_tables_dungeon_loot_tables_LootTableId", column: x => x.LootTableId, principalTable: "dungeon_loot_tables", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_dungeon_mob_loot_tables_dungeon_mob_definitions_MobDefinitio~", column: x => x.MobDefinitionId, principalTable: "dungeon_mob_definitions", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_dungeon_loot_table_entries_ItemDefinitionId", table: "dungeon_loot_table_entries", column: "ItemDefinitionId"); migrationBuilder.CreateIndex( name: "IX_dungeon_loot_table_entries_LootTableId", table: "dungeon_loot_table_entries", column: "LootTableId"); migrationBuilder.CreateIndex( name: "IX_dungeon_mob_loot_tables_LootTableId", table: "dungeon_mob_loot_tables", column: "LootTableId"); migrationBuilder.CreateIndex( name: "IX_dungeon_mob_loot_tables_MobDefinitionId", table: "dungeon_mob_loot_tables", column: "MobDefinitionId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "dungeon_loot_table_entries"); migrationBuilder.DropTable( name: "dungeon_mob_loot_tables"); migrationBuilder.DropTable( name: "dungeon_loot_tables"); } } }