Files
Backend-Api/CompanyManagment.EFCore/Migrations/20250918013449_ClassificationScheme.cs
2025-09-18 05:16:00 +03:30

202 lines
10 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class ClassificationScheme : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ClassificationSchemes",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
IncludingDateGr = table.Column<DateTime>(type: "datetime2", nullable: false),
ExecutionDateGr = table.Column<DateTime>(type: "datetime2", nullable: false),
EndSchemeDateGr = table.Column<DateTime>(type: "datetime2", nullable: true),
DesignerFullName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
DesignerPhone = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
WorkshopId = table.Column<long>(type: "bigint", nullable: false),
TypeOfCoefficient = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClassificationSchemes", x => x.id);
});
migrationBuilder.CreateTable(
name: "ClassificationGroups",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
GroupNo = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true),
WorkshopId = table.Column<long>(type: "bigint", nullable: false),
ClassificationSchemeId = table.Column<long>(type: "bigint", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClassificationGroups", x => x.id);
table.ForeignKey(
name: "FK_ClassificationGroups_ClassificationSchemes_ClassificationSchemeId",
column: x => x.ClassificationSchemeId,
principalTable: "ClassificationSchemes",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClassificationRialCoefficients",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ClassificationSchemeId = table.Column<long>(type: "bigint", nullable: false),
RialCoefficient = table.Column<double>(type: "float", nullable: false),
StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
EndDate = table.Column<DateTime>(type: "datetime2", nullable: false),
Year = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClassificationRialCoefficients", x => x.id);
table.ForeignKey(
name: "FK_ClassificationRialCoefficients_ClassificationSchemes_ClassificationSchemeId",
column: x => x.ClassificationSchemeId,
principalTable: "ClassificationSchemes",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClassificationEmployee",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
WorkshopId = table.Column<long>(type: "bigint", nullable: false),
EmployeeId = table.Column<long>(type: "bigint", nullable: false),
ClassificationSchemeId = table.Column<long>(type: "bigint", nullable: false),
ClassificationGroupId = table.Column<long>(type: "bigint", nullable: false),
ClassificationGroupJobId = table.Column<long>(type: "bigint", nullable: false),
StartGroupDate = table.Column<DateTime>(type: "datetime2", nullable: true),
EndGroupDate = table.Column<DateTime>(type: "datetime2", nullable: true),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClassificationEmployee", x => x.id);
table.ForeignKey(
name: "FK_ClassificationEmployee_ClassificationGroups_ClassificationGroupId",
column: x => x.ClassificationGroupId,
principalTable: "ClassificationGroups",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClassificationGroupJobs",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
JobId = table.Column<long>(type: "bigint", nullable: false),
JobName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
JobCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
ClassificationGroupId = table.Column<long>(type: "bigint", nullable: false),
GroupNo = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ClassificationGroupJobs", x => x.id);
table.ForeignKey(
name: "FK_ClassificationGroupJobs_ClassificationGroups_ClassificationGroupId",
column: x => x.ClassificationGroupId,
principalTable: "ClassificationGroups",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClassificationGroupSalaries",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ClassificationGroupId = table.Column<long>(type: "bigint", nullable: false),
GroupNo = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true),
GroupSalary = table.Column<double>(type: "float", nullable: false),
StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
EndDate = table.Column<DateTime>(type: "datetime2", nullable: false),
Year = table.Column<int>(type: "int", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClassificationGroupSalaries", x => x.id);
table.ForeignKey(
name: "FK_ClassificationGroupSalaries_ClassificationGroups_ClassificationGroupId",
column: x => x.ClassificationGroupId,
principalTable: "ClassificationGroups",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ClassificationEmployee_ClassificationGroupId",
table: "ClassificationEmployee",
column: "ClassificationGroupId");
migrationBuilder.CreateIndex(
name: "IX_ClassificationGroupJobs_ClassificationGroupId",
table: "ClassificationGroupJobs",
column: "ClassificationGroupId");
migrationBuilder.CreateIndex(
name: "IX_ClassificationGroups_ClassificationSchemeId",
table: "ClassificationGroups",
column: "ClassificationSchemeId");
migrationBuilder.CreateIndex(
name: "IX_ClassificationGroupSalaries_ClassificationGroupId",
table: "ClassificationGroupSalaries",
column: "ClassificationGroupId");
migrationBuilder.CreateIndex(
name: "IX_ClassificationRialCoefficients_ClassificationSchemeId",
table: "ClassificationRialCoefficients",
column: "ClassificationSchemeId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ClassificationEmployee");
migrationBuilder.DropTable(
name: "ClassificationGroupJobs");
migrationBuilder.DropTable(
name: "ClassificationGroupSalaries");
migrationBuilder.DropTable(
name: "ClassificationRialCoefficients");
migrationBuilder.DropTable(
name: "ClassificationGroups");
migrationBuilder.DropTable(
name: "ClassificationSchemes");
}
}
}