diff --git a/JewelryStoreDatabaseImplement/Migrations/20230616194257_init.Designer.cs b/JewelryStoreDatabaseImplement/Migrations/20230617111616_init.Designer.cs
similarity index 96%
rename from JewelryStoreDatabaseImplement/Migrations/20230616194257_init.Designer.cs
rename to JewelryStoreDatabaseImplement/Migrations/20230617111616_init.Designer.cs
index 095daf5..2a62019 100644
--- a/JewelryStoreDatabaseImplement/Migrations/20230616194257_init.Designer.cs
+++ b/JewelryStoreDatabaseImplement/Migrations/20230617111616_init.Designer.cs
@@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace JewelryStoreDatabaseImplement.Migrations
{
[DbContext(typeof(JewelryStoreDataBase))]
- [Migration("20230616194257_init")]
+ [Migration("20230617111616_init")]
partial class init
{
///
@@ -169,12 +169,15 @@ namespace JewelryStoreDatabaseImplement.Migrations
b.Property("JewelId")
.HasColumnType("int");
+ b.Property("ManufactureId")
+ .HasColumnType("int");
+
b.Property("StoreId")
.HasColumnType("int");
b.HasKey("Id");
- b.HasIndex("JewelId");
+ b.HasIndex("ManufactureId");
b.HasIndex("StoreId");
@@ -214,8 +217,8 @@ namespace JewelryStoreDatabaseImplement.Migrations
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.StoreJewel", b =>
{
b.HasOne("JewelryStoreDatabaseImplement.Models.Jewel", "Jewel")
- .WithMany()
- .HasForeignKey("JewelId")
+ .WithMany("Shops")
+ .HasForeignKey("ManufactureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@@ -240,6 +243,8 @@ namespace JewelryStoreDatabaseImplement.Migrations
b.Navigation("Components");
b.Navigation("Orders");
+
+ b.Navigation("Shops");
});
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Store", b =>
diff --git a/JewelryStoreDatabaseImplement/Migrations/20230616194257_init.cs b/JewelryStoreDatabaseImplement/Migrations/20230617111616_init.cs
similarity index 95%
rename from JewelryStoreDatabaseImplement/Migrations/20230616194257_init.cs
rename to JewelryStoreDatabaseImplement/Migrations/20230617111616_init.cs
index 11942ec..b31b60e 100644
--- a/JewelryStoreDatabaseImplement/Migrations/20230616194257_init.cs
+++ b/JewelryStoreDatabaseImplement/Migrations/20230617111616_init.cs
@@ -115,14 +115,15 @@ namespace JewelryStoreDatabaseImplement.Migrations
.Annotation("SqlServer:Identity", "1, 1"),
JewelId = table.Column(type: "int", nullable: false),
StoreId = table.Column(type: "int", nullable: false),
- Count = table.Column(type: "int", nullable: false)
+ Count = table.Column(type: "int", nullable: false),
+ ManufactureId = table.Column(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StoreJewels", x => x.Id);
table.ForeignKey(
- name: "FK_StoreJewels_Jewels_JewelId",
- column: x => x.JewelId,
+ name: "FK_StoreJewels_Jewels_ManufactureId",
+ column: x => x.ManufactureId,
principalTable: "Jewels",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
@@ -150,9 +151,9 @@ namespace JewelryStoreDatabaseImplement.Migrations
column: "JewelId");
migrationBuilder.CreateIndex(
- name: "IX_StoreJewels_JewelId",
+ name: "IX_StoreJewels_ManufactureId",
table: "StoreJewels",
- column: "JewelId");
+ column: "ManufactureId");
migrationBuilder.CreateIndex(
name: "IX_StoreJewels_StoreId",
diff --git a/JewelryStoreDatabaseImplement/Migrations/JewelryStoreDataBaseModelSnapshot.cs b/JewelryStoreDatabaseImplement/Migrations/JewelryStoreDataBaseModelSnapshot.cs
index 10dc2c0..7a76299 100644
--- a/JewelryStoreDatabaseImplement/Migrations/JewelryStoreDataBaseModelSnapshot.cs
+++ b/JewelryStoreDatabaseImplement/Migrations/JewelryStoreDataBaseModelSnapshot.cs
@@ -166,12 +166,15 @@ namespace JewelryStoreDatabaseImplement.Migrations
b.Property("JewelId")
.HasColumnType("int");
+ b.Property("ManufactureId")
+ .HasColumnType("int");
+
b.Property("StoreId")
.HasColumnType("int");
b.HasKey("Id");
- b.HasIndex("JewelId");
+ b.HasIndex("ManufactureId");
b.HasIndex("StoreId");
@@ -211,8 +214,8 @@ namespace JewelryStoreDatabaseImplement.Migrations
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.StoreJewel", b =>
{
b.HasOne("JewelryStoreDatabaseImplement.Models.Jewel", "Jewel")
- .WithMany()
- .HasForeignKey("JewelId")
+ .WithMany("Shops")
+ .HasForeignKey("ManufactureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@@ -237,6 +240,8 @@ namespace JewelryStoreDatabaseImplement.Migrations
b.Navigation("Components");
b.Navigation("Orders");
+
+ b.Navigation("Shops");
});
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Store", b =>
diff --git a/JewelryStoreDatabaseImplement/Models/Jewel.cs b/JewelryStoreDatabaseImplement/Models/Jewel.cs
index 0d01025..1d49ab5 100644
--- a/JewelryStoreDatabaseImplement/Models/Jewel.cs
+++ b/JewelryStoreDatabaseImplement/Models/Jewel.cs
@@ -42,6 +42,9 @@ namespace JewelryStoreDatabaseImplement.Models
[ForeignKey("JewelId")]
public virtual List Orders { get; set; } = new();
+ [ForeignKey("ManufactureId")]
+ public virtual List Shops { get; set; } = new();
+
public static Jewel Create(JewelryStoreDataBase context, JewelBindingModel model)
{
return new Jewel()