diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240727100624_Migration01.Designer.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240727100624_Migration01.Designer.cs
new file mode 100644
index 0000000..34fdb3c
--- /dev/null
+++ b/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240727100624_Migration01.Designer.cs
@@ -0,0 +1,274 @@
+//
+using System;
+using ElectronicsShopDataBaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace ElectronicsShopDataBaseImplement.Migrations
+{
+ [DbContext(typeof(Database))]
+ [Migration("20240727100624_Migration01")]
+ partial class Migration01
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.4")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("ClientFIO")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("ID");
+
+ b.ToTable("Clients");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("CostNum")
+ .HasColumnType("int");
+
+ b.Property("EmployeeID")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.HasKey("ID");
+
+ b.HasIndex("EmployeeID");
+
+ b.ToTable("CostItems");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Employee", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("EmployeeFIO")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Login")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("ID");
+
+ b.ToTable("Employees");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("ClientID")
+ .HasColumnType("int");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("Sum")
+ .HasColumnType("float");
+
+ b.HasKey("ID");
+
+ b.HasIndex("ClientID");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("OrderID")
+ .HasColumnType("int");
+
+ b.Property("ProductID")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("OrderID");
+
+ b.HasIndex("ProductID");
+
+ b.ToTable("OrderProducts");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("ClientID")
+ .HasColumnType("int");
+
+ b.Property("DatePaymeant")
+ .HasColumnType("datetime2");
+
+ b.Property("OrderID")
+ .HasColumnType("int");
+
+ b.Property("PayOption")
+ .HasColumnType("int");
+
+ b.Property("SumPayment")
+ .HasColumnType("float");
+
+ b.HasKey("ID");
+
+ b.ToTable("Paymeants");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("CostItemID")
+ .HasColumnType("int");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.Property("ProductName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("ID");
+
+ b.HasIndex("CostItemID");
+
+ b.ToTable("Products");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
+ {
+ b.HasOne("ElectronicsShopDataBaseImplement.Models.Employee", "Employee")
+ .WithMany()
+ .HasForeignKey("EmployeeID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Employee");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
+ {
+ b.HasOne("ElectronicsShopDataBaseImplement.Models.Client", null)
+ .WithMany("Orders")
+ .HasForeignKey("ClientID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
+ {
+ b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", "_order")
+ .WithMany("Products")
+ .HasForeignKey("OrderID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ElectronicsShopDataBaseImplement.Models.Product", "_product")
+ .WithMany()
+ .HasForeignKey("ProductID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("_order");
+
+ b.Navigation("_product");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
+ {
+ b.HasOne("ElectronicsShopDataBaseImplement.Models.CostItem", "CostItem")
+ .WithMany()
+ .HasForeignKey("CostItemID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("CostItem");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
+ {
+ b.Navigation("Orders");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
+ {
+ b.Navigation("Products");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240727100624_Migration01.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240727100624_Migration01.cs
new file mode 100644
index 0000000..c6d155e
--- /dev/null
+++ b/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240727100624_Migration01.cs
@@ -0,0 +1,48 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace ElectronicsShopDataBaseImplement.Migrations
+{
+ ///
+ public partial class Migration01 : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_Paymeants_Orders_PaymentID",
+ table: "Paymeants");
+
+ migrationBuilder.DropIndex(
+ name: "IX_Paymeants_PaymentID",
+ table: "Paymeants");
+
+ migrationBuilder.DropColumn(
+ name: "PaymentID",
+ table: "Paymeants");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn(
+ name: "PaymentID",
+ table: "Paymeants",
+ type: "int",
+ nullable: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Paymeants_PaymentID",
+ table: "Paymeants",
+ column: "PaymentID");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Paymeants_Orders_PaymentID",
+ table: "Paymeants",
+ column: "PaymentID",
+ principalTable: "Orders",
+ principalColumn: "ID");
+ }
+ }
+}
diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/DatabaseModelSnapshot.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/DatabaseModelSnapshot.cs
index cc8d2a1..0b02847 100644
--- a/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/DatabaseModelSnapshot.cs
+++ b/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/DatabaseModelSnapshot.cs
@@ -173,16 +173,11 @@ namespace ElectronicsShopDataBaseImplement.Migrations
b.Property("PayOption")
.HasColumnType("int");
- b.Property("PaymentID")
- .HasColumnType("int");
-
b.Property("SumPayment")
.HasColumnType("float");
b.HasKey("ID");
- b.HasIndex("PaymentID");
-
b.ToTable("Paymeants");
});
@@ -250,13 +245,6 @@ namespace ElectronicsShopDataBaseImplement.Migrations
b.Navigation("_product");
});
- modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
- {
- b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", null)
- .WithMany("Payments")
- .HasForeignKey("PaymentID");
- });
-
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
{
b.HasOne("ElectronicsShopDataBaseImplement.Models.CostItem", "CostItem")
@@ -275,8 +263,6 @@ namespace ElectronicsShopDataBaseImplement.Migrations
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
{
- b.Navigation("Payments");
-
b.Navigation("Products");
});
#pragma warning restore 612, 618