// Licensed to Timothy Schenk under the GNU AGPL Version 3 License. using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Server.DB.Migrations; /// public partial class VariousDeletionBehaviours : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Characters_Accounts_AccountId", table: "Characters"); migrationBuilder.AddColumn( 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); } /// 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); } }