136 lines
6.6 KiB
C#
136 lines
6.6 KiB
C#
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace SystemRevivalServer.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class LootTables : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "dungeon_loot_tables",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Description = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
MinTier = table.Column<int>(type: "int", nullable: false),
|
|
MaxTier = table.Column<int>(type: "int", nullable: false),
|
|
DropChanceMultiplier = table.Column<float>(type: "float", nullable: false),
|
|
MinDrops = table.Column<int>(type: "int", nullable: false),
|
|
MaxDrops = table.Column<int>(type: "int", nullable: false),
|
|
GuaranteedDrop = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
IsEnabled = table.Column<bool>(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<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
LootTableId = table.Column<int>(type: "int", nullable: false),
|
|
ItemDefinitionId = table.Column<int>(type: "int", nullable: false),
|
|
DropChance = table.Column<float>(type: "float", nullable: false),
|
|
MinQuantity = table.Column<int>(type: "int", nullable: false),
|
|
MaxQuantity = table.Column<int>(type: "int", nullable: false),
|
|
Weight = table.Column<int>(type: "int", nullable: false),
|
|
Guaranteed = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
DropChancePerTier = table.Column<float>(type: "float", nullable: false),
|
|
MaxDropChance = table.Column<float>(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<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
MobDefinitionId = table.Column<int>(type: "int", nullable: false),
|
|
LootTableId = table.Column<int>(type: "int", nullable: false),
|
|
Priority = table.Column<int>(type: "int", nullable: false),
|
|
RollChance = table.Column<float>(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");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
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");
|
|
}
|
|
}
|
|
}
|