using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SystemRevivalServer.Migrations
{
///
public partial class MobLoot2 : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "dungeon_death_chests",
columns: table => new
{
Id = table.Column(type: "bigint unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DungeonInstanceId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
OwnerCharacterId = table.Column(type: "bigint unsigned", nullable: false),
VictimCharacterId = table.Column(type: "bigint unsigned", nullable: true),
VictimMobDefinitionId = table.Column(type: "int", nullable: true),
X = table.Column(type: "float", nullable: false),
Y = table.Column(type: "float", nullable: false),
GoldAmount = table.Column(type: "bigint", nullable: false),
CreatedAt = table.Column(type: "datetime(6)", nullable: false),
EmptiedAt = table.Column(type: "datetime(6)", nullable: true),
IsEmpty = table.Column(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_dungeon_death_chests", x => x.Id);
table.ForeignKey(
name: "FK_dungeon_death_chests_dungeon_characters_OwnerCharacterId",
column: x => x.OwnerCharacterId,
principalTable: "dungeon_characters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_dungeon_death_chests_dungeon_characters_VictimCharacterId",
column: x => x.VictimCharacterId,
principalTable: "dungeon_characters",
principalColumn: "Id");
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "dungeon_death_chest_items",
columns: table => new
{
Id = table.Column(type: "bigint unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DeathChestId = table.Column(type: "bigint unsigned", nullable: false),
ItemDefinitionId = table.Column(type: "int", nullable: false),
Quantity = table.Column(type: "int", nullable: false),
SlotIndex = table.Column(type: "int", nullable: false),
IsTaken = table.Column(type: "tinyint(1)", nullable: false),
TakenAt = table.Column(type: "datetime(6)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_dungeon_death_chest_items", x => x.Id);
table.ForeignKey(
name: "FK_dungeon_death_chest_items_dungeon_death_chests_DeathChestId",
column: x => x.DeathChestId,
principalTable: "dungeon_death_chests",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_dungeon_death_chest_items_dungeon_item_definitions_ItemDefin~",
column: x => x.ItemDefinitionId,
principalTable: "dungeon_item_definitions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_dungeon_death_chest_items_DeathChestId",
table: "dungeon_death_chest_items",
column: "DeathChestId");
migrationBuilder.CreateIndex(
name: "IX_dungeon_death_chest_items_ItemDefinitionId",
table: "dungeon_death_chest_items",
column: "ItemDefinitionId");
migrationBuilder.CreateIndex(
name: "IX_dungeon_death_chests_OwnerCharacterId",
table: "dungeon_death_chests",
column: "OwnerCharacterId");
migrationBuilder.CreateIndex(
name: "IX_dungeon_death_chests_VictimCharacterId",
table: "dungeon_death_chests",
column: "VictimCharacterId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "dungeon_death_chest_items");
migrationBuilder.DropTable(
name: "dungeon_death_chests");
}
}
}