From 110ea6751eab067322c0558c731ac41d4de8bfc9 Mon Sep 17 00:00:00 2001 From: Stanislav Vysotskyi Date: Thu, 5 Dec 2024 17:02:00 +0300 Subject: [PATCH] - use `Restrict` for `Deletion` props --- src/DispenserProvider.DataBase/DispenserContext.cs | 4 ++-- ...2_Instead-Of-IsDeleted-Use-Another-One-LogDTO.Designer.cs} | 4 ++-- ...1205140022_Instead-Of-IsDeleted-Use-Another-One-LogDTO.cs} | 2 +- .../Migrations/DispenserContextModelSnapshot.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename src/DispenserProvider.Migrations/Migrations/{20241205134947_Instead-Of-IsDeleted-Use-Another-One-LogDTO.Designer.cs => 20241205140022_Instead-Of-IsDeleted-Use-Another-One-LogDTO.Designer.cs} (98%) rename src/DispenserProvider.Migrations/Migrations/{20241205134947_Instead-Of-IsDeleted-Use-Another-One-LogDTO.cs => 20241205140022_Instead-Of-IsDeleted-Use-Another-One-LogDTO.cs} (98%) diff --git a/src/DispenserProvider.DataBase/DispenserContext.cs b/src/DispenserProvider.DataBase/DispenserContext.cs index 3e63c55..51f29fe 100644 --- a/src/DispenserProvider.DataBase/DispenserContext.cs +++ b/src/DispenserProvider.DataBase/DispenserContext.cs @@ -62,7 +62,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.HasOne(e => e.DeletionLog) .WithMany(e => e.DeletionDispensers) .HasForeignKey(e => e.DeletionLogSignature) - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Restrict); }); modelBuilder.Entity(entity => @@ -108,7 +108,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.HasMany(e => e.DeletionDispensers) .WithOne(e => e.DeletionLog) .HasForeignKey(e => e.DeletionLogSignature) - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Restrict); }); } } \ No newline at end of file diff --git a/src/DispenserProvider.Migrations/Migrations/20241205134947_Instead-Of-IsDeleted-Use-Another-One-LogDTO.Designer.cs b/src/DispenserProvider.Migrations/Migrations/20241205140022_Instead-Of-IsDeleted-Use-Another-One-LogDTO.Designer.cs similarity index 98% rename from src/DispenserProvider.Migrations/Migrations/20241205134947_Instead-Of-IsDeleted-Use-Another-One-LogDTO.Designer.cs rename to src/DispenserProvider.Migrations/Migrations/20241205140022_Instead-Of-IsDeleted-Use-Another-One-LogDTO.Designer.cs index a4debf1..c018dcf 100644 --- a/src/DispenserProvider.Migrations/Migrations/20241205134947_Instead-Of-IsDeleted-Use-Another-One-LogDTO.Designer.cs +++ b/src/DispenserProvider.Migrations/Migrations/20241205140022_Instead-Of-IsDeleted-Use-Another-One-LogDTO.Designer.cs @@ -12,7 +12,7 @@ namespace DispenserProvider.DataBase.Migrations { [DbContext(typeof(DispenserContext))] - [Migration("20241205134947_Instead-Of-IsDeleted-Use-Another-One-LogDTO")] + [Migration("20241205140022_Instead-Of-IsDeleted-Use-Another-One-LogDTO")] partial class InsteadOfIsDeletedUseAnotherOneLogDTO { /// @@ -177,7 +177,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasOne("DispenserProvider.DataBase.Models.LogDTO", "DeletionLog") .WithMany("DeletionDispensers") .HasForeignKey("DeletionLogSignature") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("DispenserProvider.DataBase.Models.TransactionDetailDTO", "RefundDetail") .WithOne() diff --git a/src/DispenserProvider.Migrations/Migrations/20241205134947_Instead-Of-IsDeleted-Use-Another-One-LogDTO.cs b/src/DispenserProvider.Migrations/Migrations/20241205140022_Instead-Of-IsDeleted-Use-Another-One-LogDTO.cs similarity index 98% rename from src/DispenserProvider.Migrations/Migrations/20241205134947_Instead-Of-IsDeleted-Use-Another-One-LogDTO.cs rename to src/DispenserProvider.Migrations/Migrations/20241205140022_Instead-Of-IsDeleted-Use-Another-One-LogDTO.cs index 2dbe5a5..e47f003 100644 --- a/src/DispenserProvider.Migrations/Migrations/20241205134947_Instead-Of-IsDeleted-Use-Another-One-LogDTO.cs +++ b/src/DispenserProvider.Migrations/Migrations/20241205140022_Instead-Of-IsDeleted-Use-Another-One-LogDTO.cs @@ -53,7 +53,7 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "DeletionLogSignature", principalTable: "Logs", principalColumn: "Signature", - onDelete: ReferentialAction.Cascade); + onDelete: ReferentialAction.Restrict); } /// diff --git a/src/DispenserProvider.Migrations/Migrations/DispenserContextModelSnapshot.cs b/src/DispenserProvider.Migrations/Migrations/DispenserContextModelSnapshot.cs index eb24d44..c96d48c 100644 --- a/src/DispenserProvider.Migrations/Migrations/DispenserContextModelSnapshot.cs +++ b/src/DispenserProvider.Migrations/Migrations/DispenserContextModelSnapshot.cs @@ -174,7 +174,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasOne("DispenserProvider.DataBase.Models.LogDTO", "DeletionLog") .WithMany("DeletionDispensers") .HasForeignKey("DeletionLogSignature") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("DispenserProvider.DataBase.Models.TransactionDetailDTO", "RefundDetail") .WithOne()