From 4ae6ea799f1e7223c05a1e613368d37535c0b9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=B0=D0=BB=D0=B8=D0=BD=D0=B0=20=D0=A4=D0=B5=D0=B4?= =?UTF-8?q?=D0=BE=D1=80=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Sat, 25 May 2024 16:19:18 +0400 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=B4=D0=B0=D0=BD=D0=BD=D0=B0=D1=8F=203?= =?UTF-8?q?=20=D1=83=D1=81=D0=BB=D0=BE=D0=B6=D0=BD=D0=B5=D0=BD=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... 20240522074840_InitialCreate.Designer.cs} | 81 ++++++++++++++++++- ...ate.cs => 20240522074840_InitialCreate.cs} | 59 ++++++++++++++ .../CarpentryWorkshopDatabaseModelSnapshot.cs | 79 ++++++++++++++++++ 3 files changed, 218 insertions(+), 1 deletion(-) rename CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/{20240313050649_InitialCreate.Designer.cs => 20240522074840_InitialCreate.Designer.cs} (67%) rename CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/{20240313050649_InitialCreate.cs => 20240522074840_InitialCreate.cs} (66%) diff --git a/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240313050649_InitialCreate.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240522074840_InitialCreate.Designer.cs similarity index 67% rename from CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240313050649_InitialCreate.Designer.cs rename to CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240522074840_InitialCreate.Designer.cs index 8691b14..7c8dafc 100644 --- a/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240313050649_InitialCreate.Designer.cs +++ b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240522074840_InitialCreate.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace CarpentryWorkshopDatabaseImplement.Migrations { [DbContext(typeof(CarpentryWorkshopDatabase))] - [Migration("20240313050649_InitialCreate")] + [Migration("20240522074840_InitialCreate")] partial class InitialCreate { /// @@ -78,6 +78,59 @@ namespace CarpentryWorkshopDatabaseImplement.Migrations b.ToTable("Orders"); }); + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Shop", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateOpen") + .HasColumnType("datetime2"); + + b.Property("ShopName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("WoodMaxCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Shops"); + }); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.ShopWood", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("ShopId") + .HasColumnType("int"); + + b.Property("WoodId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ShopId"); + + b.HasIndex("WoodId"); + + b.ToTable("ShopWoods"); + }); + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Wood", b => { b.Property("Id") @@ -135,6 +188,25 @@ namespace CarpentryWorkshopDatabaseImplement.Migrations b.Navigation("Wood"); }); + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.ShopWood", b => + { + b.HasOne("CarpentryWorkshopDatabaseImplement.Models.Shop", "Shop") + .WithMany("Woods") + .HasForeignKey("ShopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarpentryWorkshopDatabaseImplement.Models.Wood", "Wood") + .WithMany("ShopWoods") + .HasForeignKey("WoodId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Shop"); + + b.Navigation("Wood"); + }); + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.WoodComponent", b => { b.HasOne("CarpentryWorkshopDatabaseImplement.Models.Component", "Component") @@ -159,11 +231,18 @@ namespace CarpentryWorkshopDatabaseImplement.Migrations b.Navigation("WoodComponents"); }); + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Shop", b => + { + b.Navigation("Woods"); + }); + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Wood", b => { b.Navigation("Components"); b.Navigation("Orders"); + + b.Navigation("ShopWoods"); }); #pragma warning restore 612, 618 } diff --git a/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240313050649_InitialCreate.cs b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240522074840_InitialCreate.cs similarity index 66% rename from CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240313050649_InitialCreate.cs rename to CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240522074840_InitialCreate.cs index 709f7b0..12471ed 100644 --- a/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240313050649_InitialCreate.cs +++ b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240522074840_InitialCreate.cs @@ -25,6 +25,22 @@ namespace CarpentryWorkshopDatabaseImplement.Migrations table.PrimaryKey("PK_Components", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Shops", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ShopName = table.Column(type: "nvarchar(max)", nullable: false), + Address = table.Column(type: "nvarchar(max)", nullable: false), + DateOpen = table.Column(type: "datetime2", nullable: false), + WoodMaxCount = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Shops", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Woods", columns: table => new @@ -63,6 +79,33 @@ namespace CarpentryWorkshopDatabaseImplement.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "ShopWoods", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + WoodId = table.Column(type: "int", nullable: false), + ShopId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShopWoods", x => x.Id); + table.ForeignKey( + name: "FK_ShopWoods_Shops_ShopId", + column: x => x.ShopId, + principalTable: "Shops", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShopWoods_Woods_WoodId", + column: x => x.WoodId, + principalTable: "Woods", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "WoodComponents", columns: table => new @@ -95,6 +138,16 @@ namespace CarpentryWorkshopDatabaseImplement.Migrations table: "Orders", column: "WoodId"); + migrationBuilder.CreateIndex( + name: "IX_ShopWoods_ShopId", + table: "ShopWoods", + column: "ShopId"); + + migrationBuilder.CreateIndex( + name: "IX_ShopWoods_WoodId", + table: "ShopWoods", + column: "WoodId"); + migrationBuilder.CreateIndex( name: "IX_WoodComponents_ComponentId", table: "WoodComponents", @@ -112,9 +165,15 @@ namespace CarpentryWorkshopDatabaseImplement.Migrations migrationBuilder.DropTable( name: "Orders"); + migrationBuilder.DropTable( + name: "ShopWoods"); + migrationBuilder.DropTable( name: "WoodComponents"); + migrationBuilder.DropTable( + name: "Shops"); + migrationBuilder.DropTable( name: "Components"); diff --git a/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/CarpentryWorkshopDatabaseModelSnapshot.cs b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/CarpentryWorkshopDatabaseModelSnapshot.cs index 912c18b..17df5e8 100644 --- a/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/CarpentryWorkshopDatabaseModelSnapshot.cs +++ b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/CarpentryWorkshopDatabaseModelSnapshot.cs @@ -75,6 +75,59 @@ namespace CarpentryWorkshopDatabaseImplement.Migrations b.ToTable("Orders"); }); + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Shop", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateOpen") + .HasColumnType("datetime2"); + + b.Property("ShopName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("WoodMaxCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Shops"); + }); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.ShopWood", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("ShopId") + .HasColumnType("int"); + + b.Property("WoodId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ShopId"); + + b.HasIndex("WoodId"); + + b.ToTable("ShopWoods"); + }); + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Wood", b => { b.Property("Id") @@ -132,6 +185,25 @@ namespace CarpentryWorkshopDatabaseImplement.Migrations b.Navigation("Wood"); }); + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.ShopWood", b => + { + b.HasOne("CarpentryWorkshopDatabaseImplement.Models.Shop", "Shop") + .WithMany("Woods") + .HasForeignKey("ShopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarpentryWorkshopDatabaseImplement.Models.Wood", "Wood") + .WithMany("ShopWoods") + .HasForeignKey("WoodId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Shop"); + + b.Navigation("Wood"); + }); + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.WoodComponent", b => { b.HasOne("CarpentryWorkshopDatabaseImplement.Models.Component", "Component") @@ -156,11 +228,18 @@ namespace CarpentryWorkshopDatabaseImplement.Migrations b.Navigation("WoodComponents"); }); + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Shop", b => + { + b.Navigation("Woods"); + }); + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Wood", b => { b.Navigation("Components"); b.Navigation("Orders"); + + b.Navigation("ShopWoods"); }); #pragma warning restore 612, 618 }