Files
Backend-Api/CompanyManagment.EFCore/Migrations/20230626181107_AddedPersonnelCodeTable.cs
2024-07-05 21:36:15 +03:30

60 lines
2.2 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace CompanyManagment.EFCore.Migrations
{
public partial class AddedPersonnelCodeTable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PersonnelCodes",
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),
PersonnelCode = table.Column<long>(type: "bigint", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PersonnelCodes", x => x.id);
table.ForeignKey(
name: "FK_PersonnelCodes_Employees_EmployeeId",
column: x => x.EmployeeId,
principalTable: "Employees",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PersonnelCodes_Workshops_WorkshopId",
column: x => x.WorkshopId,
principalTable: "Workshops",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_PersonnelCodes_EmployeeId",
table: "PersonnelCodes",
column: "EmployeeId");
migrationBuilder.CreateIndex(
name: "IX_PersonnelCodes_WorkshopId",
table: "PersonnelCodes",
column: "WorkshopId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PersonnelCodes");
}
}
}