From c8b2e6fdbb4b02c64a309c773c95b303f2661935 Mon Sep 17 00:00:00 2001 From: K Date: Wed, 1 May 2024 17:10:21 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D1=87=D0=B8=D0=BD=D0=B8=D0=BB?= =?UTF-8?q?=E0=BC=BC=20=E0=BC=8E=E0=BA=B6=20=E0=B7=B4=20=E0=BC=8E=E0=BA=B6?= =?UTF-8?q?=E0=BC=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...er.cs => 20240501140440_initial.Designer.cs} | 13 ++----------- ...019_initial.cs => 20240501140440_initial.cs} | 17 +++-------------- .../BeautySalonDatabaseModelSnapshot.cs | 11 +---------- .../Models/Procedure.cs | 2 +- 4 files changed, 7 insertions(+), 36 deletions(-) rename BeautySalonView/BeautySalonDatabaseImplement/Migrations/{20240501133019_initial.Designer.cs => 20240501140440_initial.Designer.cs} (98%) rename BeautySalonView/BeautySalonDatabaseImplement/Migrations/{20240501133019_initial.cs => 20240501140440_initial.cs} (97%) diff --git a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240501133019_initial.Designer.cs b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240501140440_initial.Designer.cs similarity index 98% rename from BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240501133019_initial.Designer.cs rename to BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240501140440_initial.Designer.cs index c37ae3c..eedb788 100644 --- a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240501133019_initial.Designer.cs +++ b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240501140440_initial.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace BeautySalonDatabaseImplement.Migrations { [DbContext(typeof(BeautySalonDatabase))] - [Migration("20240501133019_initial")] + [Migration("20240501140440_initial")] partial class initial { /// @@ -181,17 +181,12 @@ namespace BeautySalonDatabaseImplement.Migrations b.Property("OrderId") .HasColumnType("int"); - b.Property("ProcedureId") - .HasColumnType("int"); - b.HasKey("Id"); b.HasIndex("CosmeticId"); b.HasIndex("OrderId"); - b.HasIndex("ProcedureId"); - b.ToTable("OrderCosmetics"); }); @@ -487,10 +482,6 @@ namespace BeautySalonDatabaseImplement.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("BeautySalonDatabaseImplement.Models.Procedure", null) - .WithMany("Orders") - .HasForeignKey("ProcedureId"); - b.Navigation("Cosmetic"); b.Navigation("Order"); @@ -505,7 +496,7 @@ namespace BeautySalonDatabaseImplement.Migrations .IsRequired(); b.HasOne("BeautySalonDatabaseImplement.Models.Procedure", "Procedure") - .WithMany() + .WithMany("Orders") .HasForeignKey("ProcedureId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); diff --git a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240501133019_initial.cs b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240501140440_initial.cs similarity index 97% rename from BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240501133019_initial.cs rename to BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240501140440_initial.cs index 441c717..32f59b7 100644 --- a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240501133019_initial.cs +++ b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240501140440_initial.cs @@ -86,7 +86,7 @@ namespace BeautySalonDatabaseImplement.Migrations column: x => x.ClientId, principalTable: "Clients", principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + onDelete: ReferentialAction.NoAction); }); migrationBuilder.CreateTable( @@ -183,7 +183,7 @@ namespace BeautySalonDatabaseImplement.Migrations column: x => x.ProcedureId, principalTable: "Procedures", principalColumn: "Id", - onDelete: ReferentialAction.NoAction); + onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( @@ -296,8 +296,7 @@ namespace BeautySalonDatabaseImplement.Migrations Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), OrderId = table.Column(type: "int", nullable: false), - CosmeticId = table.Column(type: "int", nullable: false), - ProcedureId = table.Column(type: "int", nullable: true) + CosmeticId = table.Column(type: "int", nullable: false) }, constraints: table => { @@ -314,11 +313,6 @@ namespace BeautySalonDatabaseImplement.Migrations principalTable: "Orders", principalColumn: "Id", onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_OrderCosmetics_Procedures_ProcedureId", - column: x => x.ProcedureId, - principalTable: "Procedures", - principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -388,11 +382,6 @@ namespace BeautySalonDatabaseImplement.Migrations table: "OrderCosmetics", column: "OrderId"); - migrationBuilder.CreateIndex( - name: "IX_OrderCosmetics_ProcedureId", - table: "OrderCosmetics", - column: "ProcedureId"); - migrationBuilder.CreateIndex( name: "IX_OrderProcedures_OrderId", table: "OrderProcedures", diff --git a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/BeautySalonDatabaseModelSnapshot.cs b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/BeautySalonDatabaseModelSnapshot.cs index 8e71c65..2399607 100644 --- a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/BeautySalonDatabaseModelSnapshot.cs +++ b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/BeautySalonDatabaseModelSnapshot.cs @@ -178,17 +178,12 @@ namespace BeautySalonDatabaseImplement.Migrations b.Property("OrderId") .HasColumnType("int"); - b.Property("ProcedureId") - .HasColumnType("int"); - b.HasKey("Id"); b.HasIndex("CosmeticId"); b.HasIndex("OrderId"); - b.HasIndex("ProcedureId"); - b.ToTable("OrderCosmetics"); }); @@ -484,10 +479,6 @@ namespace BeautySalonDatabaseImplement.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("BeautySalonDatabaseImplement.Models.Procedure", null) - .WithMany("Orders") - .HasForeignKey("ProcedureId"); - b.Navigation("Cosmetic"); b.Navigation("Order"); @@ -502,7 +493,7 @@ namespace BeautySalonDatabaseImplement.Migrations .IsRequired(); b.HasOne("BeautySalonDatabaseImplement.Models.Procedure", "Procedure") - .WithMany() + .WithMany("Orders") .HasForeignKey("ProcedureId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); diff --git a/BeautySalonView/BeautySalonDatabaseImplement/Models/Procedure.cs b/BeautySalonView/BeautySalonDatabaseImplement/Models/Procedure.cs index 2157f5a..e3b5edc 100644 --- a/BeautySalonView/BeautySalonDatabaseImplement/Models/Procedure.cs +++ b/BeautySalonView/BeautySalonDatabaseImplement/Models/Procedure.cs @@ -63,7 +63,7 @@ namespace BeautySalonDatabaseImplement.Models // связь процедур и заказов многие - ко - многим [ForeignKey("ProcedureId")] - public virtual List Orders { get; set; } = new(); + public virtual List Orders { get; set; } = new(); // связь процедур и заказов многие - ко - многим [ForeignKey("ProcedureId")]