diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230226160632_InitMigration.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230226160632_InitMigration.cs
new file mode 100644
index 0000000..acc77f9
--- /dev/null
+++ b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230226160632_InitMigration.cs
@@ -0,0 +1,115 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace IceCreamShopDatabaseImplement.Migrations
+{
+ ///
+ public partial class InitMigration : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Components",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ ComponentName = table.Column(type: "nvarchar(max)", nullable: false),
+ Cost = table.Column(type: "float", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Components", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "IceCreams",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ IceCreamName = table.Column(type: "nvarchar(max)", nullable: false),
+ Price = table.Column(type: "float", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_IceCreams", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Orders",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ IceCreamId = table.Column(type: "int", nullable: false),
+ IceCreamName = table.Column(type: "nvarchar(max)", nullable: false),
+ Count = table.Column(type: "int", nullable: false),
+ Sum = table.Column(type: "float", nullable: false),
+ Status = table.Column(type: "int", nullable: false),
+ DateCreate = table.Column(type: "datetime2", nullable: false),
+ DateImplement = table.Column(type: "datetime2", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Orders", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "IceCreamComponents",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ IceCreamId = table.Column(type: "int", nullable: false),
+ ComponentId = table.Column(type: "int", nullable: false),
+ Count = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_IceCreamComponents", x => x.Id);
+ table.ForeignKey(
+ name: "FK_IceCreamComponents_Components_ComponentId",
+ column: x => x.ComponentId,
+ principalTable: "Components",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_IceCreamComponents_IceCreams_IceCreamId",
+ column: x => x.IceCreamId,
+ principalTable: "IceCreams",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_IceCreamComponents_ComponentId",
+ table: "IceCreamComponents",
+ column: "ComponentId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_IceCreamComponents_IceCreamId",
+ table: "IceCreamComponents",
+ column: "IceCreamId");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "IceCreamComponents");
+
+ migrationBuilder.DropTable(
+ name: "Orders");
+
+ migrationBuilder.DropTable(
+ name: "Components");
+
+ migrationBuilder.DropTable(
+ name: "IceCreams");
+ }
+ }
+}
diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230313191542_NewMigration.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230313191542_NewMigration.cs
new file mode 100644
index 0000000..9a429e5
--- /dev/null
+++ b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230313191542_NewMigration.cs
@@ -0,0 +1,22 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace IceCreamShopDatabaseImplement.Migrations
+{
+ ///
+ public partial class NewMigration : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+
+ }
+ }
+}
diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230327111426_LabWork05Migr.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230327111426_LabWork05Migr.cs
new file mode 100644
index 0000000..9be063b
--- /dev/null
+++ b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230327111426_LabWork05Migr.cs
@@ -0,0 +1,69 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace IceCreamShopDatabaseImplement.Migrations
+{
+ ///
+ public partial class LabWork05Migr : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.Sql("TRUNCATE TABLE Orders");
+ 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/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230408135215_implementer.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230408135215_implementer.cs
new file mode 100644
index 0000000..34ba28a
--- /dev/null
+++ b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230408135215_implementer.cs
@@ -0,0 +1,67 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace IceCreamShopDatabaseImplement.Migrations
+{
+ ///
+ public partial class implementer : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn(
+ name: "ImplementerId",
+ table: "Orders",
+ type: "int",
+ nullable: true);
+
+ migrationBuilder.CreateTable(
+ name: "Implementers",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ ImplementerFIO = table.Column(type: "nvarchar(max)", nullable: false),
+ Password = table.Column(type: "nvarchar(max)", nullable: false),
+ WorkExperience = table.Column(type: "int", nullable: false),
+ Qualification = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Implementers", x => x.Id);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Orders_ImplementerId",
+ table: "Orders",
+ column: "ImplementerId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Orders_Implementers_ImplementerId",
+ table: "Orders",
+ column: "ImplementerId",
+ principalTable: "Implementers",
+ principalColumn: "Id");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_Orders_Implementers_ImplementerId",
+ table: "Orders");
+
+ migrationBuilder.DropTable(
+ name: "Implementers");
+
+ migrationBuilder.DropIndex(
+ name: "IX_Orders_ImplementerId",
+ table: "Orders");
+
+ migrationBuilder.DropColumn(
+ name: "ImplementerId",
+ table: "Orders");
+ }
+ }
+}
diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230409123459_shops.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230409123459_shops.cs
new file mode 100644
index 0000000..5855cac
--- /dev/null
+++ b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20230409123459_shops.cs
@@ -0,0 +1,95 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace IceCreamShopDatabaseImplement.Migrations
+{
+ ///
+ public partial class shops : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+
+
+ migrationBuilder.CreateTable(
+ name: "Shops",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Name = table.Column(type: "nvarchar(max)", nullable: false),
+ Adress = table.Column(type: "nvarchar(max)", nullable: false),
+ OpeningDate = table.Column(type: "datetime2", nullable: false),
+ IceCreamMaxCount = table.Column(type: "int", nullable: false),
+ IceCreamId = table.Column(type: "int", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Shops", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Shops_IceCreams_IceCreamId",
+ column: x => x.IceCreamId,
+ principalTable: "IceCreams",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateTable(
+ name: "IceCreams",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ IceCreamId = 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_ShopIcecreams", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ShopIcecreams_IceCreams_IceCreamId",
+ column: x => x.IceCreamId,
+ principalTable: "IceCreams",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_ShopIcecreams_Shops_ShopId",
+ column: x => x.ShopId,
+ principalTable: "Shops",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ShopIcecreams_IceCreamId",
+ table: "IceCreams",
+ column: "IceCreamId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ShopIcecreams_ShopId",
+ table: "IceCreams",
+ column: "ShopId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Shops_IceCreamId",
+ table: "Shops",
+ column: "IceCreamId");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "IceCreams");
+
+ migrationBuilder.DropTable(
+ name: "Shops");
+
+ migrationBuilder.DropColumn(
+ name: "IceCreamName",
+ table: "Orders");
+ }
+ }
+}