Set all database dependencies to set null on delete.

This commit is contained in:
2019-11-08 00:56:59 +00:00
parent ad2d2bbf37
commit a6ee989044
4 changed files with 4869 additions and 840 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,925 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class SetAllOnDeleteSetNull : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Ata_TestedMedia_ReadCapabilitiesId",
table: "Ata");
migrationBuilder.DropForeignKey(
name: "FK_BlockDescriptor_ScsiMode_ScsiModeId",
table: "BlockDescriptor");
migrationBuilder.DropForeignKey(
name: "FK_DensityCode_SscSupportedMedia_SscSupportedMediaId",
table: "DensityCode");
migrationBuilder.DropForeignKey(
name: "FK_Devices_Ata_ATAId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_Ata_ATAPIId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_CdOffsets_CdOffsetId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_FireWire_FireWireId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_MmcSd_MultiMediaCardId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_Pcmcia_PCMCIAId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_Scsi_SCSIId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_MmcSd_SecureDigitalId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_Usb_USBId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_DeviceStats_Devices_ReportId",
table: "DeviceStats");
migrationBuilder.DropForeignKey(
name: "FK_Mmc_MmcFeatures_FeaturesId",
table: "Mmc");
migrationBuilder.DropForeignKey(
name: "FK_Reports_Ata_ATAId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_Ata_ATAPIId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_FireWire_FireWireId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_MmcSd_MultiMediaCardId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_Pcmcia_PCMCIAId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_Scsi_SCSIId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_MmcSd_SecureDigitalId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_Usb_USBId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Scsi_ScsiMode_ModeSenseId",
table: "Scsi");
migrationBuilder.DropForeignKey(
name: "FK_Scsi_Mmc_MultiMediaDeviceId",
table: "Scsi");
migrationBuilder.DropForeignKey(
name: "FK_Scsi_TestedMedia_ReadCapabilitiesId",
table: "Scsi");
migrationBuilder.DropForeignKey(
name: "FK_Scsi_Ssc_SequentialDeviceId",
table: "Scsi");
migrationBuilder.DropForeignKey(
name: "FK_ScsiPage_Scsi_ScsiId",
table: "ScsiPage");
migrationBuilder.DropForeignKey(
name: "FK_ScsiPage_ScsiMode_ScsiModeId",
table: "ScsiPage");
migrationBuilder.DropForeignKey(
name: "FK_SscSupportedMedia_Ssc_SscId",
table: "SscSupportedMedia");
migrationBuilder.DropForeignKey(
name: "FK_SscSupportedMedia_TestedSequentialMedia_TestedSequentialMedi~",
table: "SscSupportedMedia");
migrationBuilder.DropForeignKey(
name: "FK_SupportedDensity_Ssc_SscId",
table: "SupportedDensity");
migrationBuilder.DropForeignKey(
name: "FK_SupportedDensity_TestedSequentialMedia_TestedSequentialMedia~",
table: "SupportedDensity");
migrationBuilder.DropForeignKey(
name: "FK_TestedMedia_Ata_AtaId",
table: "TestedMedia");
migrationBuilder.DropForeignKey(
name: "FK_TestedMedia_Chs_CHSId",
table: "TestedMedia");
migrationBuilder.DropForeignKey(
name: "FK_TestedMedia_Chs_CurrentCHSId",
table: "TestedMedia");
migrationBuilder.DropForeignKey(
name: "FK_TestedMedia_Mmc_MmcId",
table: "TestedMedia");
migrationBuilder.DropForeignKey(
name: "FK_TestedMedia_Scsi_ScsiId",
table: "TestedMedia");
migrationBuilder.DropForeignKey(
name: "FK_TestedSequentialMedia_Ssc_SscId",
table: "TestedSequentialMedia");
migrationBuilder.AddForeignKey(
name: "FK_Ata_TestedMedia_ReadCapabilitiesId",
table: "Ata",
column: "ReadCapabilitiesId",
principalTable: "TestedMedia",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_BlockDescriptor_ScsiMode_ScsiModeId",
table: "BlockDescriptor",
column: "ScsiModeId",
principalTable: "ScsiMode",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_DensityCode_SscSupportedMedia_SscSupportedMediaId",
table: "DensityCode",
column: "SscSupportedMediaId",
principalTable: "SscSupportedMedia",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Devices_Ata_ATAId",
table: "Devices",
column: "ATAId",
principalTable: "Ata",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Devices_Ata_ATAPIId",
table: "Devices",
column: "ATAPIId",
principalTable: "Ata",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Devices_CdOffsets_CdOffsetId",
table: "Devices",
column: "CdOffsetId",
principalTable: "CdOffsets",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Devices_FireWire_FireWireId",
table: "Devices",
column: "FireWireId",
principalTable: "FireWire",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Devices_MmcSd_MultiMediaCardId",
table: "Devices",
column: "MultiMediaCardId",
principalTable: "MmcSd",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Devices_Pcmcia_PCMCIAId",
table: "Devices",
column: "PCMCIAId",
principalTable: "Pcmcia",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Devices_Scsi_SCSIId",
table: "Devices",
column: "SCSIId",
principalTable: "Scsi",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Devices_MmcSd_SecureDigitalId",
table: "Devices",
column: "SecureDigitalId",
principalTable: "MmcSd",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Devices_Usb_USBId",
table: "Devices",
column: "USBId",
principalTable: "Usb",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_DeviceStats_Devices_ReportId",
table: "DeviceStats",
column: "ReportId",
principalTable: "Devices",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Mmc_MmcFeatures_FeaturesId",
table: "Mmc",
column: "FeaturesId",
principalTable: "MmcFeatures",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Reports_Ata_ATAId",
table: "Reports",
column: "ATAId",
principalTable: "Ata",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Reports_Ata_ATAPIId",
table: "Reports",
column: "ATAPIId",
principalTable: "Ata",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Reports_FireWire_FireWireId",
table: "Reports",
column: "FireWireId",
principalTable: "FireWire",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Reports_MmcSd_MultiMediaCardId",
table: "Reports",
column: "MultiMediaCardId",
principalTable: "MmcSd",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Reports_Pcmcia_PCMCIAId",
table: "Reports",
column: "PCMCIAId",
principalTable: "Pcmcia",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Reports_Scsi_SCSIId",
table: "Reports",
column: "SCSIId",
principalTable: "Scsi",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Reports_MmcSd_SecureDigitalId",
table: "Reports",
column: "SecureDigitalId",
principalTable: "MmcSd",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Reports_Usb_USBId",
table: "Reports",
column: "USBId",
principalTable: "Usb",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Scsi_ScsiMode_ModeSenseId",
table: "Scsi",
column: "ModeSenseId",
principalTable: "ScsiMode",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Scsi_Mmc_MultiMediaDeviceId",
table: "Scsi",
column: "MultiMediaDeviceId",
principalTable: "Mmc",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Scsi_TestedMedia_ReadCapabilitiesId",
table: "Scsi",
column: "ReadCapabilitiesId",
principalTable: "TestedMedia",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Scsi_Ssc_SequentialDeviceId",
table: "Scsi",
column: "SequentialDeviceId",
principalTable: "Ssc",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_ScsiPage_Scsi_ScsiId",
table: "ScsiPage",
column: "ScsiId",
principalTable: "Scsi",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_ScsiPage_ScsiMode_ScsiModeId",
table: "ScsiPage",
column: "ScsiModeId",
principalTable: "ScsiMode",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_SscSupportedMedia_Ssc_SscId",
table: "SscSupportedMedia",
column: "SscId",
principalTable: "Ssc",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_SscSupportedMedia_TestedSequentialMedia_TestedSequentialMedi~",
table: "SscSupportedMedia",
column: "TestedSequentialMediaId",
principalTable: "TestedSequentialMedia",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_SupportedDensity_Ssc_SscId",
table: "SupportedDensity",
column: "SscId",
principalTable: "Ssc",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_SupportedDensity_TestedSequentialMedia_TestedSequentialMedia~",
table: "SupportedDensity",
column: "TestedSequentialMediaId",
principalTable: "TestedSequentialMedia",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_TestedMedia_Ata_AtaId",
table: "TestedMedia",
column: "AtaId",
principalTable: "Ata",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_TestedMedia_Chs_CHSId",
table: "TestedMedia",
column: "CHSId",
principalTable: "Chs",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_TestedMedia_Chs_CurrentCHSId",
table: "TestedMedia",
column: "CurrentCHSId",
principalTable: "Chs",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_TestedMedia_Mmc_MmcId",
table: "TestedMedia",
column: "MmcId",
principalTable: "Mmc",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_TestedMedia_Scsi_ScsiId",
table: "TestedMedia",
column: "ScsiId",
principalTable: "Scsi",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_TestedSequentialMedia_Ssc_SscId",
table: "TestedSequentialMedia",
column: "SscId",
principalTable: "Ssc",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Ata_TestedMedia_ReadCapabilitiesId",
table: "Ata");
migrationBuilder.DropForeignKey(
name: "FK_BlockDescriptor_ScsiMode_ScsiModeId",
table: "BlockDescriptor");
migrationBuilder.DropForeignKey(
name: "FK_DensityCode_SscSupportedMedia_SscSupportedMediaId",
table: "DensityCode");
migrationBuilder.DropForeignKey(
name: "FK_Devices_Ata_ATAId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_Ata_ATAPIId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_CdOffsets_CdOffsetId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_FireWire_FireWireId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_MmcSd_MultiMediaCardId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_Pcmcia_PCMCIAId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_Scsi_SCSIId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_MmcSd_SecureDigitalId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_Devices_Usb_USBId",
table: "Devices");
migrationBuilder.DropForeignKey(
name: "FK_DeviceStats_Devices_ReportId",
table: "DeviceStats");
migrationBuilder.DropForeignKey(
name: "FK_Mmc_MmcFeatures_FeaturesId",
table: "Mmc");
migrationBuilder.DropForeignKey(
name: "FK_Reports_Ata_ATAId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_Ata_ATAPIId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_FireWire_FireWireId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_MmcSd_MultiMediaCardId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_Pcmcia_PCMCIAId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_Scsi_SCSIId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_MmcSd_SecureDigitalId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Reports_Usb_USBId",
table: "Reports");
migrationBuilder.DropForeignKey(
name: "FK_Scsi_ScsiMode_ModeSenseId",
table: "Scsi");
migrationBuilder.DropForeignKey(
name: "FK_Scsi_Mmc_MultiMediaDeviceId",
table: "Scsi");
migrationBuilder.DropForeignKey(
name: "FK_Scsi_TestedMedia_ReadCapabilitiesId",
table: "Scsi");
migrationBuilder.DropForeignKey(
name: "FK_Scsi_Ssc_SequentialDeviceId",
table: "Scsi");
migrationBuilder.DropForeignKey(
name: "FK_ScsiPage_Scsi_ScsiId",
table: "ScsiPage");
migrationBuilder.DropForeignKey(
name: "FK_ScsiPage_ScsiMode_ScsiModeId",
table: "ScsiPage");
migrationBuilder.DropForeignKey(
name: "FK_SscSupportedMedia_Ssc_SscId",
table: "SscSupportedMedia");
migrationBuilder.DropForeignKey(
name: "FK_SscSupportedMedia_TestedSequentialMedia_TestedSequentialMedi~",
table: "SscSupportedMedia");
migrationBuilder.DropForeignKey(
name: "FK_SupportedDensity_Ssc_SscId",
table: "SupportedDensity");
migrationBuilder.DropForeignKey(
name: "FK_SupportedDensity_TestedSequentialMedia_TestedSequentialMedia~",
table: "SupportedDensity");
migrationBuilder.DropForeignKey(
name: "FK_TestedMedia_Ata_AtaId",
table: "TestedMedia");
migrationBuilder.DropForeignKey(
name: "FK_TestedMedia_Chs_CHSId",
table: "TestedMedia");
migrationBuilder.DropForeignKey(
name: "FK_TestedMedia_Chs_CurrentCHSId",
table: "TestedMedia");
migrationBuilder.DropForeignKey(
name: "FK_TestedMedia_Mmc_MmcId",
table: "TestedMedia");
migrationBuilder.DropForeignKey(
name: "FK_TestedMedia_Scsi_ScsiId",
table: "TestedMedia");
migrationBuilder.DropForeignKey(
name: "FK_TestedSequentialMedia_Ssc_SscId",
table: "TestedSequentialMedia");
migrationBuilder.AddForeignKey(
name: "FK_Ata_TestedMedia_ReadCapabilitiesId",
table: "Ata",
column: "ReadCapabilitiesId",
principalTable: "TestedMedia",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BlockDescriptor_ScsiMode_ScsiModeId",
table: "BlockDescriptor",
column: "ScsiModeId",
principalTable: "ScsiMode",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_DensityCode_SscSupportedMedia_SscSupportedMediaId",
table: "DensityCode",
column: "SscSupportedMediaId",
principalTable: "SscSupportedMedia",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Devices_Ata_ATAId",
table: "Devices",
column: "ATAId",
principalTable: "Ata",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Devices_Ata_ATAPIId",
table: "Devices",
column: "ATAPIId",
principalTable: "Ata",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Devices_CdOffsets_CdOffsetId",
table: "Devices",
column: "CdOffsetId",
principalTable: "CdOffsets",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Devices_FireWire_FireWireId",
table: "Devices",
column: "FireWireId",
principalTable: "FireWire",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Devices_MmcSd_MultiMediaCardId",
table: "Devices",
column: "MultiMediaCardId",
principalTable: "MmcSd",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Devices_Pcmcia_PCMCIAId",
table: "Devices",
column: "PCMCIAId",
principalTable: "Pcmcia",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Devices_Scsi_SCSIId",
table: "Devices",
column: "SCSIId",
principalTable: "Scsi",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Devices_MmcSd_SecureDigitalId",
table: "Devices",
column: "SecureDigitalId",
principalTable: "MmcSd",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Devices_Usb_USBId",
table: "Devices",
column: "USBId",
principalTable: "Usb",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_DeviceStats_Devices_ReportId",
table: "DeviceStats",
column: "ReportId",
principalTable: "Devices",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Mmc_MmcFeatures_FeaturesId",
table: "Mmc",
column: "FeaturesId",
principalTable: "MmcFeatures",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Reports_Ata_ATAId",
table: "Reports",
column: "ATAId",
principalTable: "Ata",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Reports_Ata_ATAPIId",
table: "Reports",
column: "ATAPIId",
principalTable: "Ata",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Reports_FireWire_FireWireId",
table: "Reports",
column: "FireWireId",
principalTable: "FireWire",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Reports_MmcSd_MultiMediaCardId",
table: "Reports",
column: "MultiMediaCardId",
principalTable: "MmcSd",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Reports_Pcmcia_PCMCIAId",
table: "Reports",
column: "PCMCIAId",
principalTable: "Pcmcia",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Reports_Scsi_SCSIId",
table: "Reports",
column: "SCSIId",
principalTable: "Scsi",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Reports_MmcSd_SecureDigitalId",
table: "Reports",
column: "SecureDigitalId",
principalTable: "MmcSd",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Reports_Usb_USBId",
table: "Reports",
column: "USBId",
principalTable: "Usb",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Scsi_ScsiMode_ModeSenseId",
table: "Scsi",
column: "ModeSenseId",
principalTable: "ScsiMode",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Scsi_Mmc_MultiMediaDeviceId",
table: "Scsi",
column: "MultiMediaDeviceId",
principalTable: "Mmc",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Scsi_TestedMedia_ReadCapabilitiesId",
table: "Scsi",
column: "ReadCapabilitiesId",
principalTable: "TestedMedia",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Scsi_Ssc_SequentialDeviceId",
table: "Scsi",
column: "SequentialDeviceId",
principalTable: "Ssc",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_ScsiPage_Scsi_ScsiId",
table: "ScsiPage",
column: "ScsiId",
principalTable: "Scsi",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_ScsiPage_ScsiMode_ScsiModeId",
table: "ScsiPage",
column: "ScsiModeId",
principalTable: "ScsiMode",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_SscSupportedMedia_Ssc_SscId",
table: "SscSupportedMedia",
column: "SscId",
principalTable: "Ssc",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_SscSupportedMedia_TestedSequentialMedia_TestedSequentialMedi~",
table: "SscSupportedMedia",
column: "TestedSequentialMediaId",
principalTable: "TestedSequentialMedia",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_SupportedDensity_Ssc_SscId",
table: "SupportedDensity",
column: "SscId",
principalTable: "Ssc",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_SupportedDensity_TestedSequentialMedia_TestedSequentialMedia~",
table: "SupportedDensity",
column: "TestedSequentialMediaId",
principalTable: "TestedSequentialMedia",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_TestedMedia_Ata_AtaId",
table: "TestedMedia",
column: "AtaId",
principalTable: "Ata",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_TestedMedia_Chs_CHSId",
table: "TestedMedia",
column: "CHSId",
principalTable: "Chs",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_TestedMedia_Chs_CurrentCHSId",
table: "TestedMedia",
column: "CurrentCHSId",
principalTable: "Chs",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_TestedMedia_Mmc_MmcId",
table: "TestedMedia",
column: "MmcId",
principalTable: "Mmc",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_TestedMedia_Scsi_ScsiId",
table: "TestedMedia",
column: "ScsiId",
principalTable: "Scsi",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_TestedSequentialMedia_Ssc_SscId",
table: "TestedSequentialMedia",
column: "SscId",
principalTable: "Ssc",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

View File

@@ -90,6 +90,144 @@ namespace DiscImageChef.Server.Models
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Ata", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany().
HasForeignKey("ReadCapabilitiesId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.BlockDescriptor", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.ScsiMode", null).WithMany("BlockDescriptors").
HasForeignKey("ScsiModeId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.DensityCode", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.SscSupportedMedia", null).WithMany("DensityCodes").
HasForeignKey("SscSupportedMediaId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Mmc", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcFeatures", "Features").WithMany().
HasForeignKey("FeaturesId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Scsi", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.ScsiMode", "ModeSense").WithMany().
HasForeignKey("ModeSenseId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Mmc", "MultiMediaDevice").WithMany().
HasForeignKey("MultiMediaDeviceId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany().
HasForeignKey("ReadCapabilitiesId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", "SequentialDevice").WithMany().
HasForeignKey("SequentialDeviceId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.ScsiPage", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", null).WithMany("EVPDPages").HasForeignKey("ScsiId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.ScsiMode", null).WithMany("ModePages").
HasForeignKey("ScsiModeId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.SscSupportedMedia", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", null).WithMany("SupportedMediaTypes").
HasForeignKey("SscId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia", null).
WithMany("SupportedMediaTypes").HasForeignKey("TestedSequentialMediaId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.SupportedDensity", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", null).WithMany("SupportedDensities").
HasForeignKey("SscId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia", null).
WithMany("SupportedDensities").HasForeignKey("TestedSequentialMediaId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.TestedMedia", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", null).WithMany("RemovableMedias").
HasForeignKey("AtaId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Chs", "CHS").WithMany().HasForeignKey("CHSId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Chs", "CurrentCHS").WithMany().
HasForeignKey("CurrentCHSId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Mmc", null).WithMany("TestedMedia").HasForeignKey("MmcId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", null).WithMany("RemovableMedias").
HasForeignKey("ScsiId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", null).WithMany("TestedMedia").HasForeignKey("SscId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("DiscImageChef.Server.Models.Device", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATA").WithMany().HasForeignKey("ATAId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATAPI").WithMany().HasForeignKey("ATAPIId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.Server.Models.CompactDiscOffset", "CdOffset").WithMany("Devices").
HasForeignKey("CdOffsetId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.FireWire", "FireWire").WithMany().
HasForeignKey("FireWireId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "MultiMediaCard").WithMany().
HasForeignKey("MultiMediaCardId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Pcmcia", "PCMCIA").WithMany().HasForeignKey("PCMCIAId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", "SCSI").WithMany().HasForeignKey("SCSIId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "SecureDigital").WithMany().
HasForeignKey("SecureDigitalId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Usb", "USB").WithMany().HasForeignKey("USBId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("DiscImageChef.Server.Models.DeviceStat", b =>
{
b.HasOne("DiscImageChef.Server.Models.Device", "Report").WithMany().HasForeignKey("ReportId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("DiscImageChef.Server.Models.UploadedReport", b =>
{
b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATA").WithMany().HasForeignKey("ATAId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATAPI").WithMany().HasForeignKey("ATAPIId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.FireWire", "FireWire").WithMany().
HasForeignKey("FireWireId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "MultiMediaCard").WithMany().
HasForeignKey("MultiMediaCardId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Pcmcia", "PCMCIA").WithMany().HasForeignKey("PCMCIAId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", "SCSI").WithMany().HasForeignKey("SCSIId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "SecureDigital").WithMany().
HasForeignKey("SecureDigitalId").OnDelete(DeleteBehavior.SetNull);
b.HasOne("DiscImageChef.CommonTypes.Metadata.Usb", "USB").WithMany().HasForeignKey("USBId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity<CompactDiscOffset>().HasIndex(b => b.ModifiedWhen);
modelBuilder.Entity<Device>().HasIndex(b => b.ModifiedWhen);