diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240406155953_CreatingClients.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240406155953_CreatingClients.Designer.cs
deleted file mode 100644
index 1bdecfd..0000000
--- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240406155953_CreatingClients.Designer.cs
+++ /dev/null
@@ -1,214 +0,0 @@
-//
-using System;
-using BlacksmithWorkshopDatabaseImplement;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-#nullable disable
-
-namespace BlacksmithWorkshopDatabaseImplement.Migrations
-{
- [DbContext(typeof(BlacksmithWorkshopDataBase))]
- [Migration("20240406155953_CreatingClients")]
- partial class CreatingClients
- {
- ///
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "7.0.16")
- .HasAnnotation("Relational:MaxIdentifierLength", 128);
-
- SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
-
- modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.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("BlacksmithWorkshopDatabaseImplement.Models.Component", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("ComponentName")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Cost")
- .HasColumnType("float");
-
- b.HasKey("Id");
-
- b.ToTable("Components");
- });
-
- modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("ManufactureName")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Price")
- .HasColumnType("float");
-
- b.HasKey("Id");
-
- b.ToTable("Manufactures");
- });
-
- modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.ManufactureComponent", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("ComponentId")
- .HasColumnType("int");
-
- b.Property("Count")
- .HasColumnType("int");
-
- b.Property("ManufactureId")
- .HasColumnType("int");
-
- b.HasKey("Id");
-
- b.HasIndex("ComponentId");
-
- b.HasIndex("ManufactureId");
-
- b.ToTable("ManufactureComponents");
- });
-
- modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Order", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("ClientId")
- .HasColumnType("int");
-
- b.Property("Count")
- .HasColumnType("int");
-
- b.Property("DateCreate")
- .HasColumnType("datetime2");
-
- b.Property("DateImplement")
- .HasColumnType("datetime2");
-
- b.Property("ManufactureId")
- .HasColumnType("int");
-
- b.Property("Status")
- .HasColumnType("int");
-
- b.Property("Sum")
- .HasColumnType("float");
-
- b.HasKey("Id");
-
- b.HasIndex("ClientId");
-
- b.HasIndex("ManufactureId");
-
- b.ToTable("Orders");
- });
-
- modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.ManufactureComponent", b =>
- {
- b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Component", "Component")
- .WithMany("ManufactureComponents")
- .HasForeignKey("ComponentId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", "Manufacture")
- .WithMany("Components")
- .HasForeignKey("ManufactureId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Component");
-
- b.Navigation("Manufacture");
- });
-
- modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Order", b =>
- {
- b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Client", "Client")
- .WithMany("Orders")
- .HasForeignKey("ClientId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", "Manufacture")
- .WithMany("Orders")
- .HasForeignKey("ManufactureId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Client");
-
- b.Navigation("Manufacture");
- });
-
- modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Client", b =>
- {
- b.Navigation("Orders");
- });
-
- modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Component", b =>
- {
- b.Navigation("ManufactureComponents");
- });
-
- modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", b =>
- {
- b.Navigation("Components");
-
- b.Navigation("Orders");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240406155953_CreatingClients.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240406155953_CreatingClients.cs
deleted file mode 100644
index 536a1bc..0000000
--- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240406155953_CreatingClients.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace BlacksmithWorkshopDatabaseImplement.Migrations
-{
- ///
- public partial class CreatingClients : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "ClientId",
- table: "Orders",
- type: "int",
- nullable: false,
- defaultValue: 0);
-
- migrationBuilder.CreateTable(
- name: "Clients",
- columns: table => new
- {
- Id = table.Column(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- ClientFIO = table.Column(type: "nvarchar(max)", nullable: false),
- Email = table.Column(type: "nvarchar(max)", nullable: false),
- Password = table.Column(type: "nvarchar(max)", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Clients", x => x.Id);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_Orders_ClientId",
- table: "Orders",
- column: "ClientId");
-
- migrationBuilder.AddForeignKey(
- name: "FK_Orders_Clients_ClientId",
- table: "Orders",
- column: "ClientId",
- principalTable: "Clients",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_Orders_Clients_ClientId",
- table: "Orders");
-
- migrationBuilder.DropTable(
- name: "Clients");
-
- migrationBuilder.DropIndex(
- name: "IX_Orders_ClientId",
- table: "Orders");
-
- migrationBuilder.DropColumn(
- name: "ClientId",
- table: "Orders");
- }
- }
-}
diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240325175852_InitialCreate.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240421170619_initialCreate.Designer.cs
similarity index 84%
rename from BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240325175852_InitialCreate.Designer.cs
rename to BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240421170619_initialCreate.Designer.cs
index 084b47e..6808a76 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240325175852_InitialCreate.Designer.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240421170619_initialCreate.Designer.cs
@@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace BlacksmithWorkshopDatabaseImplement.Migrations
{
[DbContext(typeof(BlacksmithWorkshopDataBase))]
- [Migration("20240325175852_InitialCreate")]
- partial class InitialCreate
+ [Migration("20240421170619_initialCreate")]
+ partial class initialCreate
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -25,6 +25,31 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+ modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.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("BlacksmithWorkshopDatabaseImplement.Models.Component", b =>
{
b.Property("Id")
@@ -99,6 +124,9 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+ b.Property("ClientId")
+ .HasColumnType("int");
+
b.Property("Count")
.HasColumnType("int");
@@ -119,6 +147,8 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
b.HasKey("Id");
+ b.HasIndex("ClientId");
+
b.HasIndex("ManufactureId");
b.ToTable("Orders");
@@ -198,12 +228,20 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Order", b =>
{
+ b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Client", "Client")
+ .WithMany("Orders")
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", "Manufacture")
.WithMany("Orders")
.HasForeignKey("ManufactureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.Navigation("Client");
+
b.Navigation("Manufacture");
});
@@ -226,6 +264,11 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
b.Navigation("Shop");
});
+ modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Client", b =>
+ {
+ b.Navigation("Orders");
+ });
+
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Component", b =>
{
b.Navigation("ManufactureComponents");
diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240325175852_InitialCreate.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240421170619_initialCreate.cs
similarity index 85%
rename from BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240325175852_InitialCreate.cs
rename to BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240421170619_initialCreate.cs
index b5ebbf5..a30604d 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240325175852_InitialCreate.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/20240421170619_initialCreate.cs
@@ -6,11 +6,26 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace BlacksmithWorkshopDatabaseImplement.Migrations
{
///
- public partial class InitialCreate : Migration
+ public partial class initialCreate : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
+ migrationBuilder.CreateTable(
+ name: "Clients",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ ClientFIO = table.Column(type: "nvarchar(max)", nullable: false),
+ Email = table.Column(type: "nvarchar(max)", nullable: false),
+ Password = table.Column(type: "nvarchar(max)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Clients", x => x.Id);
+ });
+
migrationBuilder.CreateTable(
name: "Components",
columns: table => new
@@ -88,6 +103,7 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
{
Id = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
+ ClientId = table.Column(type: "int", nullable: false),
Count = table.Column(type: "int", nullable: false),
Sum = table.Column(type: "float", nullable: false),
Status = table.Column(type: "int", nullable: false),
@@ -98,6 +114,12 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
constraints: table =>
{
table.PrimaryKey("PK_Orders", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Orders_Clients_ClientId",
+ column: x => x.ClientId,
+ principalTable: "Clients",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Orders_Manufactures_ManufactureId",
column: x => x.ManufactureId,
@@ -143,6 +165,11 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
table: "ManufactureComponents",
column: "ManufactureId");
+ migrationBuilder.CreateIndex(
+ name: "IX_Orders_ClientId",
+ table: "Orders",
+ column: "ClientId");
+
migrationBuilder.CreateIndex(
name: "IX_Orders_ManufactureId",
table: "Orders",
@@ -174,6 +201,9 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
migrationBuilder.DropTable(
name: "Components");
+ migrationBuilder.DropTable(
+ name: "Clients");
+
migrationBuilder.DropTable(
name: "Manufactures");
diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/BlacksmithWorkshopDataBaseModelSnapshot.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/BlacksmithWorkshopDataBaseModelSnapshot.cs
index e0bce8b..fffa9c0 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/BlacksmithWorkshopDataBaseModelSnapshot.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Migrations/BlacksmithWorkshopDataBaseModelSnapshot.cs
@@ -22,6 +22,31 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+ modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.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("BlacksmithWorkshopDatabaseImplement.Models.Component", b =>
{
b.Property("Id")
@@ -96,6 +121,9 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+ b.Property("ClientId")
+ .HasColumnType("int");
+
b.Property("Count")
.HasColumnType("int");
@@ -116,6 +144,8 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
b.HasKey("Id");
+ b.HasIndex("ClientId");
+
b.HasIndex("ManufactureId");
b.ToTable("Orders");
@@ -195,12 +225,20 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Order", b =>
{
+ b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Client", "Client")
+ .WithMany("Orders")
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", "Manufacture")
.WithMany("Orders")
.HasForeignKey("ManufactureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.Navigation("Client");
+
b.Navigation("Manufacture");
});
@@ -223,6 +261,11 @@ namespace BlacksmithWorkshopDatabaseImplement.Migrations
b.Navigation("Shop");
});
+ modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Client", b =>
+ {
+ b.Navigation("Orders");
+ });
+
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Component", b =>
{
b.Navigation("ManufactureComponents");