Files
systemrevivalserver/Migrations/20251217153958_MobLoot2.cs
T
2025-12-17 12:49:34 -05:00

112 lines
5.4 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SystemRevivalServer.Migrations
{
/// <inheritdoc />
public partial class MobLoot2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "dungeon_death_chests",
columns: table => new
{
Id = table.Column<ulong>(type: "bigint unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DungeonInstanceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
OwnerCharacterId = table.Column<ulong>(type: "bigint unsigned", nullable: false),
VictimCharacterId = table.Column<ulong>(type: "bigint unsigned", nullable: true),
VictimMobDefinitionId = table.Column<int>(type: "int", nullable: true),
X = table.Column<float>(type: "float", nullable: false),
Y = table.Column<float>(type: "float", nullable: false),
GoldAmount = table.Column<long>(type: "bigint", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
EmptiedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
IsEmpty = table.Column<bool>(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<ulong>(type: "bigint unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DeathChestId = table.Column<ulong>(type: "bigint unsigned", nullable: false),
ItemDefinitionId = table.Column<int>(type: "int", nullable: false),
Quantity = table.Column<int>(type: "int", nullable: false),
SlotIndex = table.Column<int>(type: "int", nullable: false),
IsTaken = table.Column<bool>(type: "tinyint(1)", nullable: false),
TakenAt = table.Column<DateTime>(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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "dungeon_death_chest_items");
migrationBuilder.DropTable(
name: "dungeon_death_chests");
}
}
}