74 lines
2.2 KiB
C#
74 lines
2.2 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 VariousDeletionBehaviours : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Characters_Accounts_AccountId",
|
|
table: "Characters");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "GuildMemberId",
|
|
table: "Accounts",
|
|
type: "uuid",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Accounts_GuildMemberId",
|
|
table: "Accounts",
|
|
column: "GuildMemberId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Accounts_GuildMember_GuildMemberId",
|
|
table: "Accounts",
|
|
column: "GuildMemberId",
|
|
principalTable: "GuildMember",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Characters_Accounts_AccountId",
|
|
table: "Characters",
|
|
column: "AccountId",
|
|
principalTable: "Accounts",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Accounts_GuildMember_GuildMemberId",
|
|
table: "Accounts");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Characters_Accounts_AccountId",
|
|
table: "Characters");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Accounts_GuildMemberId",
|
|
table: "Accounts");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "GuildMemberId",
|
|
table: "Accounts");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Characters_Accounts_AccountId",
|
|
table: "Characters",
|
|
column: "AccountId",
|
|
principalTable: "Accounts",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
}
|
|
}
|