82 lines
3.4 KiB
C#
82 lines
3.4 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace CompanyManagment.EFCore.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class EbiAdded : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Banks",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
BankName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
|
BankLogoMediaId = table.Column<long>(type: "bigint", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Banks", x => x.id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "EmployeeBankInformationSet",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
EmployeeId = table.Column<long>(type: "bigint", nullable: false),
|
|
WorkshopId = table.Column<long>(type: "bigint", nullable: false),
|
|
BankId = table.Column<long>(type: "bigint", nullable: false),
|
|
BankAccountNumber = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
|
|
CardNumber = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: true),
|
|
ShebaNumber = table.Column<string>(type: "nvarchar(26)", maxLength: 26, nullable: true),
|
|
IsDefault = table.Column<bool>(type: "bit", nullable: false),
|
|
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_EmployeeBankInformationSet", x => x.id);
|
|
table.ForeignKey(
|
|
name: "FK_EmployeeBankInformationSet_Banks_BankId",
|
|
column: x => x.BankId,
|
|
principalTable: "Banks",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_EmployeeBankInformationSet_Employees_EmployeeId",
|
|
column: x => x.EmployeeId,
|
|
principalTable: "Employees",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_EmployeeBankInformationSet_BankId",
|
|
table: "EmployeeBankInformationSet",
|
|
column: "BankId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_EmployeeBankInformationSet_EmployeeId",
|
|
table: "EmployeeBankInformationSet",
|
|
column: "EmployeeId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "EmployeeBankInformationSet");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Banks");
|
|
}
|
|
}
|
|
}
|