60 lines
2.2 KiB
C#
60 lines
2.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace CompanyManagment.EFCore.Migrations
|
|
{
|
|
public partial class EmployeeAccAndEmployerAcc : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "EmployeeAccounts",
|
|
columns: table => new
|
|
{
|
|
EmployeeId = table.Column<long>(type: "bigint", nullable: false),
|
|
AccountId = table.Column<long>(type: "bigint", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_EmployeeAccounts", x => new { x.EmployeeId, x.AccountId });
|
|
table.ForeignKey(
|
|
name: "FK_EmployeeAccounts_Employees_EmployeeId",
|
|
column: x => x.EmployeeId,
|
|
principalTable: "Employees",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "EmployerAccounts",
|
|
columns: table => new
|
|
{
|
|
EmployerId = table.Column<long>(type: "bigint", nullable: false),
|
|
AccountId = table.Column<long>(type: "bigint", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_EmployerAccounts", x => new { x.EmployerId, x.AccountId });
|
|
table.ForeignKey(
|
|
name: "FK_EmployerAccounts_Employers_EmployerId",
|
|
column: x => x.EmployerId,
|
|
principalTable: "Employers",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "EmployeeAccounts");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "EmployerAccounts");
|
|
|
|
}
|
|
}
|
|
}
|