using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FlexJobApi.Database.Migrations.Migrations
{
///
public partial class UpdateEnterpriseEmployee0822 : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "ContractCode",
table: "EnterpriseEmployee",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn(
name: "ContractTemplateId",
table: "EnterpriseEmployee",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn(
name: "BindProperty",
table: "ContractTemplateValue",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.CreateTable(
name: "EnterpriseEmployeeContract",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
EnterpriseEmployeeId = table.Column(type: "uniqueidentifier", nullable: false),
ContractTemplateId = table.Column(type: "uniqueidentifier", nullable: true),
UserSignContractStatus = table.Column(type: "int", nullable: true),
UserSignContractTime = table.Column(type: "datetime2", nullable: true),
EnterpriseSignContractStatus = table.Column(type: "int", nullable: true),
EnterpriseSignContractTime = table.Column(type: "datetime2", nullable: true),
ContractCode = table.Column(type: "nvarchar(max)", nullable: true),
ContractUrl = table.Column(type: "nvarchar(max)", nullable: true),
Sort = table.Column(type: "int", nullable: false),
TraceId = table.Column(type: "nvarchar(max)", nullable: true),
CreatedTime = table.Column(type: "datetimeoffset", nullable: false),
CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
CreatedEnterpriseId = table.Column(type: "uniqueidentifier", nullable: true),
UpdatedTime = table.Column(type: "datetimeoffset", nullable: true),
UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EnterpriseEmployeeContract", x => x.Id);
table.ForeignKey(
name: "FK_EnterpriseEmployeeContract_EnterpriseEmployee_EnterpriseEmployeeId",
column: x => x.EnterpriseEmployeeId,
principalTable: "EnterpriseEmployee",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_EnterpriseEmployee_ContractTemplateId",
table: "EnterpriseEmployee",
column: "ContractTemplateId");
migrationBuilder.CreateIndex(
name: "IX_EnterpriseEmployeeContract_EnterpriseEmployeeId",
table: "EnterpriseEmployeeContract",
column: "EnterpriseEmployeeId");
migrationBuilder.AddForeignKey(
name: "FK_EnterpriseEmployee_ContractTemplate_ContractTemplateId",
table: "EnterpriseEmployee",
column: "ContractTemplateId",
principalTable: "ContractTemplate",
principalColumn: "Id");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EnterpriseEmployee_ContractTemplate_ContractTemplateId",
table: "EnterpriseEmployee");
migrationBuilder.DropTable(
name: "EnterpriseEmployeeContract");
migrationBuilder.DropIndex(
name: "IX_EnterpriseEmployee_ContractTemplateId",
table: "EnterpriseEmployee");
migrationBuilder.DropColumn(
name: "ContractCode",
table: "EnterpriseEmployee");
migrationBuilder.DropColumn(
name: "ContractTemplateId",
table: "EnterpriseEmployee");
migrationBuilder.DropColumn(
name: "BindProperty",
table: "ContractTemplateValue");
}
}
}