Cascade delete archives when game is deleted
This commit is contained in:
parent
2625aec8ff
commit
1c51b2643e
3 changed files with 1061 additions and 1 deletions
1020
LANCommander/Migrations/20230109073520_CascadeGameArchiveDeletion.Designer.cs
generated
Normal file
1020
LANCommander/Migrations/20230109073520_CascadeGameArchiveDeletion.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,38 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace LANCommander.Migrations
|
||||||
|
{
|
||||||
|
public partial class CascadeGameArchiveDeletion : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Archive_Games_GameId",
|
||||||
|
table: "Archive");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Archive_Games_GameId",
|
||||||
|
table: "Archive",
|
||||||
|
column: "GameId",
|
||||||
|
principalTable: "Games",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Archive_Games_GameId",
|
||||||
|
table: "Archive");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Archive_Games_GameId",
|
||||||
|
table: "Archive",
|
||||||
|
column: "GameId",
|
||||||
|
principalTable: "Games",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -794,7 +794,9 @@ namespace LANCommander.Migrations
|
||||||
|
|
||||||
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
b.HasOne("LANCommander.Data.Models.Game", "Game")
|
||||||
.WithMany("Archives")
|
.WithMany("Archives")
|
||||||
.HasForeignKey("GameId");
|
.HasForeignKey("GameId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("LANCommander.Data.Models.Archive", "LastVersion")
|
b.HasOne("LANCommander.Data.Models.Archive", "LastVersion")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
|
|
Loading…
Add table
Reference in a new issue