Remove tested media and mmc features when an mmc is deleted.

This commit is contained in:
2019-11-13 00:41:04 +00:00
parent 69cc41c3c7
commit dbf9b5bc55
5 changed files with 2313 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class CascadeDeleteMmcFeatures : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey("FK_TestedMedia_Mmc_MmcId", "TestedMedia");
migrationBuilder.AddForeignKey("FK_TestedMedia_Mmc_MmcId", "TestedMedia", "MmcId", "Mmc",
principalColumn: "Id", onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey("FK_TestedMedia_Mmc_MmcId", "TestedMedia");
migrationBuilder.AddForeignKey("FK_TestedMedia_Mmc_MmcId", "TestedMedia", "MmcId", "Mmc",
principalColumn: "Id", onDelete: ReferentialAction.SetNull);
}
}
}

View File

@@ -1498,7 +1498,7 @@ namespace DiscImageChef.Server.Migrations
HasForeignKey("CurrentCHSId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Mmc", null).WithMany("TestedMedia").HasForeignKey("MmcId").
OnDelete(DeleteBehavior.SetNull);
OnDelete(DeleteBehavior.Cascade);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", null).WithMany("RemovableMedias").
HasForeignKey("ScsiId").OnDelete(DeleteBehavior.SetNull);