263 lines
7.7 KiB
C#
263 lines
7.7 KiB
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||
|
|
||
|
#nullable disable
|
||
|
|
||
|
namespace Server.DB.Migrations;
|
||
|
|
||
|
/// <inheritdoc />
|
||
|
public partial class AddAdditionalIndices : Migration
|
||
|
{
|
||
|
/// <inheritdoc />
|
||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||
|
{
|
||
|
migrationBuilder.AlterColumn<int>(
|
||
|
name: "ItemId",
|
||
|
table: "InventoryItem",
|
||
|
type: "integer",
|
||
|
nullable: false,
|
||
|
oldClrType: typeof(short),
|
||
|
oldType: "smallint");
|
||
|
|
||
|
migrationBuilder.AddColumn<short>(
|
||
|
name: "BaseStats_Dexterity",
|
||
|
table: "Characters",
|
||
|
type: "smallint",
|
||
|
nullable: true);
|
||
|
|
||
|
migrationBuilder.AddColumn<short>(
|
||
|
name: "BaseStats_Intelligence",
|
||
|
table: "Characters",
|
||
|
type: "smallint",
|
||
|
nullable: true);
|
||
|
|
||
|
migrationBuilder.AddColumn<short>(
|
||
|
name: "BaseStats_Luck",
|
||
|
table: "Characters",
|
||
|
type: "smallint",
|
||
|
nullable: true);
|
||
|
|
||
|
migrationBuilder.AddColumn<short>(
|
||
|
name: "BaseStats_Strength",
|
||
|
table: "Characters",
|
||
|
type: "smallint",
|
||
|
nullable: true);
|
||
|
|
||
|
migrationBuilder.AddColumn<short>(
|
||
|
name: "BaseStats_Vitality",
|
||
|
table: "Characters",
|
||
|
type: "smallint",
|
||
|
nullable: true);
|
||
|
|
||
|
migrationBuilder.AddColumn<short>(
|
||
|
name: "BaseStats_Wisdom",
|
||
|
table: "Characters",
|
||
|
type: "smallint",
|
||
|
nullable: true);
|
||
|
|
||
|
migrationBuilder.AddColumn<Guid>(
|
||
|
name: "GuildId",
|
||
|
table: "Characters",
|
||
|
type: "uuid",
|
||
|
nullable: false,
|
||
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||
|
|
||
|
migrationBuilder.AddColumn<int>(
|
||
|
name: "Health",
|
||
|
table: "Characters",
|
||
|
type: "integer",
|
||
|
nullable: false,
|
||
|
defaultValue: 0);
|
||
|
|
||
|
migrationBuilder.AddColumn<byte>(
|
||
|
name: "JobData_FirstJob",
|
||
|
table: "Characters",
|
||
|
type: "smallint",
|
||
|
nullable: true);
|
||
|
|
||
|
migrationBuilder.AddColumn<byte>(
|
||
|
name: "JobData_FourthJob",
|
||
|
table: "Characters",
|
||
|
type: "smallint",
|
||
|
nullable: true);
|
||
|
|
||
|
migrationBuilder.AddColumn<byte>(
|
||
|
name: "JobData_SecondJob",
|
||
|
table: "Characters",
|
||
|
type: "smallint",
|
||
|
nullable: true);
|
||
|
|
||
|
migrationBuilder.AddColumn<byte>(
|
||
|
name: "JobData_ThirdJob",
|
||
|
table: "Characters",
|
||
|
type: "smallint",
|
||
|
nullable: true);
|
||
|
|
||
|
migrationBuilder.AddColumn<int>(
|
||
|
name: "Mana",
|
||
|
table: "Characters",
|
||
|
type: "integer",
|
||
|
nullable: false,
|
||
|
defaultValue: 0);
|
||
|
|
||
|
migrationBuilder.CreateTable(
|
||
|
name: "Guild",
|
||
|
columns: table => new
|
||
|
{
|
||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||
|
Name = table.Column<string>(type: "text", nullable: true),
|
||
|
Notice = table.Column<string>(type: "text", nullable: true)
|
||
|
},
|
||
|
constraints: table =>
|
||
|
{
|
||
|
table.PrimaryKey("PK_Guild", x => x.Id);
|
||
|
});
|
||
|
|
||
|
migrationBuilder.CreateTable(
|
||
|
name: "GuildMember",
|
||
|
columns: table => new
|
||
|
{
|
||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||
|
CharacterId = table.Column<Guid>(type: "uuid", nullable: false),
|
||
|
GuildId = table.Column<Guid>(type: "uuid", nullable: false),
|
||
|
Rank = table.Column<byte>(type: "smallint", nullable: false)
|
||
|
},
|
||
|
constraints: table =>
|
||
|
{
|
||
|
table.PrimaryKey("PK_GuildMember", x => x.Id);
|
||
|
table.ForeignKey(
|
||
|
name: "FK_GuildMember_Characters_CharacterId",
|
||
|
column: x => x.CharacterId,
|
||
|
principalTable: "Characters",
|
||
|
principalColumn: "Id",
|
||
|
onDelete: ReferentialAction.Cascade);
|
||
|
table.ForeignKey(
|
||
|
name: "FK_GuildMember_Guild_GuildId",
|
||
|
column: x => x.GuildId,
|
||
|
principalTable: "Guild",
|
||
|
principalColumn: "Id",
|
||
|
onDelete: ReferentialAction.Cascade);
|
||
|
});
|
||
|
|
||
|
migrationBuilder.CreateIndex(
|
||
|
name: "IX_Characters_GuildId",
|
||
|
table: "Characters",
|
||
|
column: "GuildId");
|
||
|
|
||
|
migrationBuilder.CreateIndex(
|
||
|
name: "IX_Characters_Name",
|
||
|
table: "Characters",
|
||
|
column: "Name",
|
||
|
unique: true);
|
||
|
|
||
|
migrationBuilder.CreateIndex(
|
||
|
name: "IX_Accounts_Username",
|
||
|
table: "Accounts",
|
||
|
column: "Username",
|
||
|
unique: true);
|
||
|
|
||
|
migrationBuilder.CreateIndex(
|
||
|
name: "IX_GuildMember_CharacterId",
|
||
|
table: "GuildMember",
|
||
|
column: "CharacterId");
|
||
|
|
||
|
migrationBuilder.CreateIndex(
|
||
|
name: "IX_GuildMember_GuildId",
|
||
|
table: "GuildMember",
|
||
|
column: "GuildId");
|
||
|
|
||
|
migrationBuilder.AddForeignKey(
|
||
|
name: "FK_Characters_Guild_GuildId",
|
||
|
table: "Characters",
|
||
|
column: "GuildId",
|
||
|
principalTable: "Guild",
|
||
|
principalColumn: "Id",
|
||
|
onDelete: ReferentialAction.Cascade);
|
||
|
}
|
||
|
|
||
|
/// <inheritdoc />
|
||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||
|
{
|
||
|
migrationBuilder.DropForeignKey(
|
||
|
name: "FK_Characters_Guild_GuildId",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropTable(
|
||
|
name: "GuildMember");
|
||
|
|
||
|
migrationBuilder.DropTable(
|
||
|
name: "Guild");
|
||
|
|
||
|
migrationBuilder.DropIndex(
|
||
|
name: "IX_Characters_GuildId",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropIndex(
|
||
|
name: "IX_Characters_Name",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropIndex(
|
||
|
name: "IX_Accounts_Username",
|
||
|
table: "Accounts");
|
||
|
|
||
|
migrationBuilder.DropColumn(
|
||
|
name: "BaseStats_Dexterity",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropColumn(
|
||
|
name: "BaseStats_Intelligence",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropColumn(
|
||
|
name: "BaseStats_Luck",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropColumn(
|
||
|
name: "BaseStats_Strength",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropColumn(
|
||
|
name: "BaseStats_Vitality",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropColumn(
|
||
|
name: "BaseStats_Wisdom",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropColumn(
|
||
|
name: "GuildId",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropColumn(
|
||
|
name: "Health",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropColumn(
|
||
|
name: "JobData_FirstJob",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropColumn(
|
||
|
name: "JobData_FourthJob",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropColumn(
|
||
|
name: "JobData_SecondJob",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropColumn(
|
||
|
name: "JobData_ThirdJob",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.DropColumn(
|
||
|
name: "Mana",
|
||
|
table: "Characters");
|
||
|
|
||
|
migrationBuilder.AlterColumn<short>(
|
||
|
name: "ItemId",
|
||
|
table: "InventoryItem",
|
||
|
type: "smallint",
|
||
|
nullable: false,
|
||
|
oldClrType: typeof(int),
|
||
|
oldType: "integer");
|
||
|
}
|
||
|
}
|