2024-03-22 09:14:00 +04:00
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
|
|
|
|
|
|
#nullable disable
|
|
|
|
|
|
|
|
|
|
namespace DinerDataBaseImplement.Migrations
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public partial class InitMigration : Migration
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
{
|
2024-05-01 21:05:07 +04:00
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "Clients",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
ID = table.Column<int>(type: "int", nullable: false)
|
|
|
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
|
|
|
ClientFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
|
|
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
|
|
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_Clients", x => x.ID);
|
|
|
|
|
});
|
|
|
|
|
|
2024-03-22 09:14:00 +04:00
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "Components",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
ID = table.Column<int>(type: "int", nullable: false)
|
|
|
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
|
|
|
ComponentName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
|
|
|
Price = table.Column<double>(type: "float", nullable: false)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_Components", x => x.ID);
|
|
|
|
|
});
|
|
|
|
|
|
2024-05-13 16:49:39 +04:00
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "Implementers",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
ID = table.Column<int>(type: "int", nullable: false)
|
|
|
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
|
|
|
ImplementerFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
|
|
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
|
|
|
WorkExperience = table.Column<int>(type: "int", nullable: false),
|
|
|
|
|
Qualification = table.Column<int>(type: "int", nullable: false)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_Implementers", x => x.ID);
|
|
|
|
|
});
|
|
|
|
|
|
2024-03-22 09:14:00 +04:00
|
|
|
|
migrationBuilder.CreateTable(
|
2024-05-11 22:14:52 +04:00
|
|
|
|
name: "Snacks",
|
2024-03-22 09:14:00 +04:00
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
ID = table.Column<int>(type: "int", nullable: false)
|
|
|
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
2024-05-01 21:05:07 +04:00
|
|
|
|
ProductName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
|
|
|
Price = table.Column<double>(type: "float", nullable: false)
|
2024-03-22 09:14:00 +04:00
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
2024-05-11 22:14:52 +04:00
|
|
|
|
table.PrimaryKey("PK_Snacks", x => x.ID);
|
2024-03-22 09:14:00 +04:00
|
|
|
|
});
|
|
|
|
|
|
2024-05-16 18:05:13 +04:00
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "MessageInfos",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
MessageID = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
|
|
|
ClientID = table.Column<int>(type: "int", nullable: true),
|
|
|
|
|
SenderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
|
|
|
DateDelivery = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
|
|
|
Subject = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
|
|
|
Body = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_MessageInfos", x => x.MessageID);
|
|
|
|
|
table.ForeignKey(
|
|
|
|
|
name: "FK_MessageInfos_Clients_ClientID",
|
|
|
|
|
column: x => x.ClientID,
|
|
|
|
|
principalTable: "Clients",
|
|
|
|
|
principalColumn: "ID");
|
|
|
|
|
});
|
|
|
|
|
|
2024-03-22 09:14:00 +04:00
|
|
|
|
migrationBuilder.CreateTable(
|
2024-05-01 21:05:07 +04:00
|
|
|
|
name: "Orders",
|
2024-03-22 09:14:00 +04:00
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
ID = table.Column<int>(type: "int", nullable: false)
|
|
|
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
2024-05-05 18:00:10 +04:00
|
|
|
|
SnackID = table.Column<int>(type: "int", nullable: false),
|
2024-05-11 22:14:52 +04:00
|
|
|
|
ClientID = table.Column<int>(type: "int", nullable: false),
|
2024-05-16 18:05:13 +04:00
|
|
|
|
ImplementerID = table.Column<int>(type: "int", nullable: true),
|
2024-05-01 21:05:07 +04:00
|
|
|
|
Count = table.Column<int>(type: "int", nullable: false),
|
|
|
|
|
Sum = table.Column<double>(type: "float", nullable: false),
|
|
|
|
|
Status = table.Column<int>(type: "int", nullable: false),
|
|
|
|
|
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
2024-05-11 22:14:52 +04:00
|
|
|
|
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true)
|
2024-03-22 09:14:00 +04:00
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
2024-05-01 21:05:07 +04:00
|
|
|
|
table.PrimaryKey("PK_Orders", x => x.ID);
|
|
|
|
|
table.ForeignKey(
|
|
|
|
|
name: "FK_Orders_Clients_ClientID",
|
|
|
|
|
column: x => x.ClientID,
|
|
|
|
|
principalTable: "Clients",
|
2024-05-11 22:14:52 +04:00
|
|
|
|
principalColumn: "ID",
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
2024-05-13 16:49:39 +04:00
|
|
|
|
table.ForeignKey(
|
|
|
|
|
name: "FK_Orders_Implementers_ImplementerID",
|
|
|
|
|
column: x => x.ImplementerID,
|
|
|
|
|
principalTable: "Implementers",
|
2024-05-16 18:05:13 +04:00
|
|
|
|
principalColumn: "ID");
|
2024-05-01 21:05:07 +04:00
|
|
|
|
table.ForeignKey(
|
2024-05-11 22:14:52 +04:00
|
|
|
|
name: "FK_Orders_Snacks_SnackID",
|
2024-05-01 21:05:07 +04:00
|
|
|
|
column: x => x.SnackID,
|
2024-05-11 22:14:52 +04:00
|
|
|
|
principalTable: "Snacks",
|
2024-05-05 18:00:10 +04:00
|
|
|
|
principalColumn: "ID",
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
2024-03-22 09:14:00 +04:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "ProductComponents",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
ID = table.Column<int>(type: "int", nullable: false)
|
|
|
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
2024-05-05 18:00:10 +04:00
|
|
|
|
SnackID = table.Column<int>(type: "int", nullable: false),
|
2024-03-22 09:14:00 +04:00
|
|
|
|
ComponentID = table.Column<int>(type: "int", nullable: false),
|
|
|
|
|
Count = table.Column<int>(type: "int", nullable: false)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_ProductComponents", x => x.ID);
|
|
|
|
|
table.ForeignKey(
|
|
|
|
|
name: "FK_ProductComponents_Components_ComponentID",
|
|
|
|
|
column: x => x.ComponentID,
|
|
|
|
|
principalTable: "Components",
|
|
|
|
|
principalColumn: "ID",
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
|
table.ForeignKey(
|
2024-05-11 22:14:52 +04:00
|
|
|
|
name: "FK_ProductComponents_Snacks_SnackID",
|
2024-05-05 18:00:10 +04:00
|
|
|
|
column: x => x.SnackID,
|
2024-05-11 22:14:52 +04:00
|
|
|
|
principalTable: "Snacks",
|
2024-03-22 09:14:00 +04:00
|
|
|
|
principalColumn: "ID",
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
|
});
|
|
|
|
|
|
2024-05-16 18:05:13 +04:00
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "IX_MessageInfos_ClientID",
|
|
|
|
|
table: "MessageInfos",
|
|
|
|
|
column: "ClientID");
|
|
|
|
|
|
2024-05-01 21:05:07 +04:00
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "IX_Orders_ClientID",
|
|
|
|
|
table: "Orders",
|
|
|
|
|
column: "ClientID");
|
|
|
|
|
|
2024-05-13 16:49:39 +04:00
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "IX_Orders_ImplementerID",
|
|
|
|
|
table: "Orders",
|
|
|
|
|
column: "ImplementerID");
|
|
|
|
|
|
2024-05-01 21:05:07 +04:00
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "IX_Orders_SnackID",
|
|
|
|
|
table: "Orders",
|
|
|
|
|
column: "SnackID");
|
|
|
|
|
|
2024-03-22 09:14:00 +04:00
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "IX_ProductComponents_ComponentID",
|
|
|
|
|
table: "ProductComponents",
|
|
|
|
|
column: "ComponentID");
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
2024-05-05 18:00:10 +04:00
|
|
|
|
name: "IX_ProductComponents_SnackID",
|
2024-03-22 09:14:00 +04:00
|
|
|
|
table: "ProductComponents",
|
2024-05-05 18:00:10 +04:00
|
|
|
|
column: "SnackID");
|
2024-03-22 09:14:00 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
|
|
|
{
|
2024-05-16 18:05:13 +04:00
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "MessageInfos");
|
|
|
|
|
|
2024-03-22 09:14:00 +04:00
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "Orders");
|
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "ProductComponents");
|
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
2024-05-01 21:05:07 +04:00
|
|
|
|
name: "Clients");
|
2024-03-22 09:14:00 +04:00
|
|
|
|
|
2024-05-13 16:49:39 +04:00
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "Implementers");
|
|
|
|
|
|
2024-03-22 09:14:00 +04:00
|
|
|
|
migrationBuilder.DropTable(
|
2024-04-19 11:14:33 +04:00
|
|
|
|
name: "Components");
|
2024-05-01 21:05:07 +04:00
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
2024-05-11 22:14:52 +04:00
|
|
|
|
name: "Snacks");
|
2024-03-22 09:14:00 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|