using System;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
#nullable disable
|
|
namespace FlexJobApi.Database.Migrations.Migrations
|
{
|
/// <inheritdoc />
|
public partial class UpdateEnterpriseEmployee0822 : Migration
|
{
|
/// <inheritdoc />
|
protected override void Up(MigrationBuilder migrationBuilder)
|
{
|
migrationBuilder.AddColumn<string>(
|
name: "ContractCode",
|
table: "EnterpriseEmployee",
|
type: "nvarchar(max)",
|
nullable: true);
|
|
migrationBuilder.AddColumn<Guid>(
|
name: "ContractTemplateId",
|
table: "EnterpriseEmployee",
|
type: "uniqueidentifier",
|
nullable: true);
|
|
migrationBuilder.AddColumn<string>(
|
name: "BindProperty",
|
table: "ContractTemplateValue",
|
type: "nvarchar(max)",
|
nullable: true);
|
|
migrationBuilder.CreateTable(
|
name: "EnterpriseEmployeeContract",
|
columns: table => new
|
{
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
EnterpriseEmployeeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
ContractTemplateId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
UserSignContractStatus = table.Column<int>(type: "int", nullable: true),
|
UserSignContractTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
EnterpriseSignContractStatus = table.Column<int>(type: "int", nullable: true),
|
EnterpriseSignContractTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
ContractCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
ContractUrl = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Sort = table.Column<int>(type: "int", nullable: false),
|
TraceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
CreatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
CreatedEnterpriseId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
UpdatedUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
IsDeleted = table.Column<bool>(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");
|
}
|
|
/// <inheritdoc />
|
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");
|
}
|
}
|
}
|