ISEbd-21_KashtanovD.A.FishF.../FishFactory/FishFactoryDatabaseImplement/Migrations/20240430182657_InitialCreate.cs

186 lines
7.6 KiB
C#
Raw Normal View History

2024-04-04 18:54:36 +04:00
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FishFactoryDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Canneds",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CannedName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Price = table.Column<double>(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Canneds", x => x.Id);
});
2024-04-26 00:17:50 +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-04-04 18:54:36 +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),
Cost = table.Column<double>(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Components", x => x.Id);
});
migrationBuilder.CreateTable(
2024-04-30 22:57:42 +04:00
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);
});
migrationBuilder.CreateTable(
name: "CannedComponents",
2024-04-04 18:54:36 +04:00
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CannedId = table.Column<int>(type: "int", nullable: false),
2024-04-30 22:57:42 +04:00
ComponentId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", nullable: false)
2024-04-04 18:54:36 +04:00
},
constraints: table =>
{
2024-04-30 22:57:42 +04:00
table.PrimaryKey("PK_CannedComponents", x => x.Id);
2024-04-04 18:54:36 +04:00
table.ForeignKey(
2024-04-30 22:57:42 +04:00
name: "FK_CannedComponents_Canneds_CannedId",
2024-04-04 18:54:36 +04:00
column: x => x.CannedId,
principalTable: "Canneds",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
2024-04-26 00:17:50 +04:00
table.ForeignKey(
2024-04-30 22:57:42 +04:00
name: "FK_CannedComponents_Components_ComponentId",
column: x => x.ComponentId,
principalTable: "Components",
2024-04-26 00:17:50 +04:00
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
2024-04-04 18:54:36 +04:00
});
migrationBuilder.CreateTable(
2024-04-30 22:57:42 +04:00
name: "Orders",
2024-04-04 18:54:36 +04:00
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
2024-04-30 22:57:42 +04:00
ClientId = table.Column<int>(type: "int", nullable: false),
2024-04-04 18:54:36 +04:00
CannedId = table.Column<int>(type: "int", nullable: false),
2024-04-30 22:57:42 +04:00
ImplementerId = table.Column<int>(type: "int", nullable: true),
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),
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true)
2024-04-04 18:54:36 +04:00
},
constraints: table =>
{
2024-04-30 22:57:42 +04:00
table.PrimaryKey("PK_Orders", x => x.Id);
2024-04-04 18:54:36 +04:00
table.ForeignKey(
2024-04-30 22:57:42 +04:00
name: "FK_Orders_Canneds_CannedId",
2024-04-04 18:54:36 +04:00
column: x => x.CannedId,
principalTable: "Canneds",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
2024-04-30 22:57:42 +04:00
name: "FK_Orders_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
2024-04-04 18:54:36 +04:00
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
2024-04-30 22:57:42 +04:00
table.ForeignKey(
name: "FK_Orders_Implementers_ImplementerId",
column: x => x.ImplementerId,
principalTable: "Implementers",
principalColumn: "Id");
2024-04-04 18:54:36 +04:00
});
migrationBuilder.CreateIndex(
name: "IX_CannedComponents_CannedId",
table: "CannedComponents",
column: "CannedId");
migrationBuilder.CreateIndex(
name: "IX_CannedComponents_ComponentId",
table: "CannedComponents",
column: "ComponentId");
migrationBuilder.CreateIndex(
name: "IX_Orders_CannedId",
table: "Orders",
column: "CannedId");
2024-04-26 00:17:50 +04:00
migrationBuilder.CreateIndex(
name: "IX_Orders_ClientId",
table: "Orders",
column: "ClientId");
2024-04-30 22:57:42 +04:00
migrationBuilder.CreateIndex(
name: "IX_Orders_ImplementerId",
table: "Orders",
column: "ImplementerId");
2024-04-04 18:54:36 +04:00
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CannedComponents");
migrationBuilder.DropTable(
name: "Orders");
migrationBuilder.DropTable(
name: "Components");
migrationBuilder.DropTable(
name: "Canneds");
2024-04-26 00:17:50 +04:00
migrationBuilder.DropTable(
name: "Clients");
2024-04-30 22:57:42 +04:00
migrationBuilder.DropTable(
name: "Implementers");
2024-04-04 18:54:36 +04:00
}
}
}