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
}