215 lines
11 KiB
C#
215 lines
11 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace SystemRevivalServer.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Cleanupunusedcode : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "equipment");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "inventories");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "characters");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "item_templates");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "characters",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<ulong>(type: "bigint unsigned", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
AccountId = table.Column<ulong>(type: "bigint unsigned", nullable: false),
|
|
ZoneId = table.Column<ulong>(type: "bigint unsigned", nullable: false),
|
|
AppearanceJson = table.Column<string>(type: "json", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"),
|
|
FacingDeg = table.Column<float>(type: "float", nullable: false),
|
|
HpCurrent = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
HpMax = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
Level = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
MpCurrent = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
MpMax = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
Name = table.Column<string>(type: "varchar(32)", maxLength: 32, nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PosX = table.Column<double>(type: "double", nullable: false),
|
|
PosY = table.Column<double>(type: "double", nullable: false),
|
|
PosZ = table.Column<double>(type: "double", nullable: false),
|
|
StaminaCurrent = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
StaminaMax = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
StatDexterity = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
StatEndurance = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
StatIntelligence = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
StatStrength = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
StatWisdom = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn),
|
|
Xp = table.Column<ulong>(type: "bigint unsigned", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_characters", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_characters_accounts_AccountId",
|
|
column: x => x.AccountId,
|
|
principalTable: "accounts",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_characters_zones_ZoneId",
|
|
column: x => x.ZoneId,
|
|
principalTable: "zones",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "item_templates",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<ulong>(type: "bigint unsigned", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"),
|
|
ItemType = table.Column<byte>(type: "tinyint unsigned", nullable: false),
|
|
MaxStack = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Rarity = table.Column<byte>(type: "tinyint unsigned", nullable: false),
|
|
StatsJson = table.Column<string>(type: "json", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn),
|
|
Weight = table.Column<uint>(type: "int unsigned", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_item_templates", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "equipment",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<ulong>(type: "bigint unsigned", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
CharacterId = table.Column<ulong>(type: "bigint unsigned", nullable: false),
|
|
ItemTemplateId = table.Column<ulong>(type: "bigint unsigned", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"),
|
|
SlotCode = table.Column<byte>(type: "tinyint unsigned", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_equipment", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_equipment_characters_CharacterId",
|
|
column: x => x.CharacterId,
|
|
principalTable: "characters",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_equipment_item_templates_ItemTemplateId",
|
|
column: x => x.ItemTemplateId,
|
|
principalTable: "item_templates",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "inventories",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<ulong>(type: "bigint unsigned", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
CharacterId = table.Column<ulong>(type: "bigint unsigned", nullable: false),
|
|
ItemTemplateId = table.Column<ulong>(type: "bigint unsigned", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"),
|
|
Quantity = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
SlotIndex = table.Column<uint>(type: "int unsigned", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_inventories", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_inventories_characters_CharacterId",
|
|
column: x => x.CharacterId,
|
|
principalTable: "characters",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_inventories_item_templates_ItemTemplateId",
|
|
column: x => x.ItemTemplateId,
|
|
principalTable: "item_templates",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_characters_AccountId",
|
|
table: "characters",
|
|
column: "AccountId",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_characters_ZoneId",
|
|
table: "characters",
|
|
column: "ZoneId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_equipment_CharacterId_SlotCode",
|
|
table: "equipment",
|
|
columns: new[] { "CharacterId", "SlotCode" },
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_equipment_ItemTemplateId",
|
|
table: "equipment",
|
|
column: "ItemTemplateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_inventories_CharacterId",
|
|
table: "inventories",
|
|
column: "CharacterId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_inventories_CharacterId_SlotIndex",
|
|
table: "inventories",
|
|
columns: new[] { "CharacterId", "SlotIndex" },
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_inventories_ItemTemplateId",
|
|
table: "inventories",
|
|
column: "ItemTemplateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_item_templates_Name",
|
|
table: "item_templates",
|
|
column: "Name",
|
|
unique: true);
|
|
}
|
|
}
|
|
}
|