Cascade delete supported densities.

This commit is contained in:
2019-11-17 22:00:00 +00:00
parent e63d7daaa0
commit 46c2eca06f
4 changed files with 2325 additions and 4 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class CascadeDeleteSupportedDensities : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey("FK_SupportedDensity_Ssc_SscId", "SupportedDensity");
migrationBuilder.DropForeignKey("FK_SupportedDensity_TestedSequentialMedia_TestedSequentialMedia~",
"SupportedDensity");
migrationBuilder.AddForeignKey("FK_SupportedDensity_Ssc_SscId", "SupportedDensity", "SscId", "Ssc",
principalColumn: "Id", onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey("FK_SupportedDensity_TestedSequentialMedia_TestedSequentialMedia~",
"SupportedDensity", "TestedSequentialMediaId", "TestedSequentialMedia",
principalColumn: "Id", onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey("FK_SupportedDensity_Ssc_SscId", "SupportedDensity");
migrationBuilder.DropForeignKey("FK_SupportedDensity_TestedSequentialMedia_TestedSequentialMedia~",
"SupportedDensity");
migrationBuilder.AddForeignKey("FK_SupportedDensity_Ssc_SscId", "SupportedDensity", "SscId", "Ssc",
principalColumn: "Id", onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey("FK_SupportedDensity_TestedSequentialMedia_TestedSequentialMedia~",
"SupportedDensity", "TestedSequentialMediaId", "TestedSequentialMedia",
principalColumn: "Id", onDelete: ReferentialAction.SetNull);
}
}
}

View File

@@ -1479,11 +1479,11 @@ namespace DiscImageChef.Server.Migrations
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.SupportedDensity", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", null).WithMany("SupportedDensities").
HasForeignKey("SscId").OnDelete(DeleteBehavior.SetNull);
HasForeignKey("SscId").OnDelete(DeleteBehavior.Cascade);
b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia", null).
WithMany("SupportedDensities").HasForeignKey("TestedSequentialMediaId").
OnDelete(DeleteBehavior.SetNull);
OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.TestedMedia", b =>

View File

@@ -151,11 +151,11 @@ namespace DiscImageChef.Server.Models
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.SupportedDensity", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", null).WithMany("SupportedDensities").
HasForeignKey("SscId").OnDelete(DeleteBehavior.SetNull);
HasForeignKey("SscId").OnDelete(DeleteBehavior.Cascade);
b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia", null).
WithMany("SupportedDensities").HasForeignKey("TestedSequentialMediaId").
OnDelete(DeleteBehavior.SetNull);
OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.TestedMedia", b =>