Timothy Schenk
1363ddf8fe
Some checks failed
Build, Package and Push Images / preprocess (push) Successful in 2s
Build, Package and Push Images / build (push) Successful in 25s
Build, Package and Push Images / sbom-scan (push) Successful in 35s
Build, Package and Push Images / container-build (push) Failing after 56s
Build, Package and Push Images / container-sbom-scan (push) Has been skipped
Build, Package and Push Images / sonarqube (push) Successful in 1m20s
166 lines
5 KiB
C#
166 lines
5 KiB
C#
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Server.DB.Migrations;
|
|
|
|
/// <inheritdoc />
|
|
public partial class FixInventoryItemAsDbset : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Characters_Guild_GuildId",
|
|
table: "Characters");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_GuildMember_Guild_GuildId",
|
|
table: "GuildMember");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_InventoryItem_Characters_CharacterId",
|
|
table: "InventoryItem");
|
|
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_InventoryItem",
|
|
table: "InventoryItem");
|
|
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_Guild",
|
|
table: "Guild");
|
|
|
|
migrationBuilder.RenameTable(
|
|
name: "InventoryItem",
|
|
newName: "InventoryItems");
|
|
|
|
migrationBuilder.RenameTable(
|
|
name: "Guild",
|
|
newName: "Guilds");
|
|
|
|
migrationBuilder.RenameIndex(
|
|
name: "IX_InventoryItem_CharacterId",
|
|
table: "InventoryItems",
|
|
newName: "IX_InventoryItems_CharacterId");
|
|
|
|
migrationBuilder.AlterColumn<Guid>(
|
|
name: "CharacterId",
|
|
table: "InventoryItems",
|
|
type: "uuid",
|
|
nullable: true,
|
|
oldClrType: typeof(Guid),
|
|
oldType: "uuid");
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_InventoryItems",
|
|
table: "InventoryItems",
|
|
column: "Id");
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_Guilds",
|
|
table: "Guilds",
|
|
column: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Characters_Guilds_GuildId",
|
|
table: "Characters",
|
|
column: "GuildId",
|
|
principalTable: "Guilds",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_GuildMember_Guilds_GuildId",
|
|
table: "GuildMember",
|
|
column: "GuildId",
|
|
principalTable: "Guilds",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_InventoryItems_Characters_CharacterId",
|
|
table: "InventoryItems",
|
|
column: "CharacterId",
|
|
principalTable: "Characters",
|
|
principalColumn: "Id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Characters_Guilds_GuildId",
|
|
table: "Characters");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_GuildMember_Guilds_GuildId",
|
|
table: "GuildMember");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_InventoryItems_Characters_CharacterId",
|
|
table: "InventoryItems");
|
|
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_InventoryItems",
|
|
table: "InventoryItems");
|
|
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_Guilds",
|
|
table: "Guilds");
|
|
|
|
migrationBuilder.RenameTable(
|
|
name: "InventoryItems",
|
|
newName: "InventoryItem");
|
|
|
|
migrationBuilder.RenameTable(
|
|
name: "Guilds",
|
|
newName: "Guild");
|
|
|
|
migrationBuilder.RenameIndex(
|
|
name: "IX_InventoryItems_CharacterId",
|
|
table: "InventoryItem",
|
|
newName: "IX_InventoryItem_CharacterId");
|
|
|
|
migrationBuilder.AlterColumn<Guid>(
|
|
name: "CharacterId",
|
|
table: "InventoryItem",
|
|
type: "uuid",
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
|
oldClrType: typeof(Guid),
|
|
oldType: "uuid",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_InventoryItem",
|
|
table: "InventoryItem",
|
|
column: "Id");
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_Guild",
|
|
table: "Guild",
|
|
column: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Characters_Guild_GuildId",
|
|
table: "Characters",
|
|
column: "GuildId",
|
|
principalTable: "Guild",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_GuildMember_Guild_GuildId",
|
|
table: "GuildMember",
|
|
column: "GuildId",
|
|
principalTable: "Guild",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_InventoryItem_Characters_CharacterId",
|
|
table: "InventoryItem",
|
|
column: "CharacterId",
|
|
principalTable: "Characters",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|