using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FlexJobApi.Database.Migrations.Migrations
{
///
public partial class UpdateUser0809 : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_UserExpectJob_DictionaryData_PersonalIdentityCode",
table: "UserExpectJob");
migrationBuilder.DropTable(
name: "UserResume");
migrationBuilder.RenameColumn(
name: "PersonalIdentityCode",
table: "UserExpectJob",
newName: "ExpectJobCode");
migrationBuilder.RenameIndex(
name: "IX_UserExpectJob_PersonalIdentityCode",
table: "UserExpectJob",
newName: "IX_UserExpectJob_ExpectJobCode");
migrationBuilder.AlterColumn(
name: "Code",
table: "UserCredential",
type: "nvarchar(128)",
maxLength: 128,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(128)",
oldMaxLength: 128);
migrationBuilder.AddColumn(
name: "EducationalBackgroundCode",
table: "User",
type: "nvarchar(128)",
nullable: true);
migrationBuilder.AddColumn(
name: "FreeTime",
table: "User",
type: "int",
nullable: true);
migrationBuilder.AddColumn(
name: "Height",
table: "User",
type: "int",
nullable: true);
migrationBuilder.AddColumn(
name: "JobSeekingStatus",
table: "User",
type: "int",
nullable: true);
migrationBuilder.AddColumn(
name: "PersonalIdentityCode",
table: "User",
type: "nvarchar(128)",
nullable: true);
migrationBuilder.AddColumn(
name: "Weight",
table: "User",
type: "int",
nullable: true);
migrationBuilder.AddColumn(
name: "WorkExperience",
table: "User",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn(
name: "WorkSeniority",
table: "User",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.UpdateData(
table: "User",
keyColumn: "Id",
keyValue: new Guid("11111111-1111-1111-1111-111111111111"),
columns: new[] { "EducationalBackgroundCode", "FreeTime", "Height", "JobSeekingStatus", "PersonalIdentityCode", "Weight", "WorkExperience", "WorkSeniority" },
values: new object[] { null, null, null, null, null, null, null, null });
migrationBuilder.CreateIndex(
name: "IX_User_EducationalBackgroundCode",
table: "User",
column: "EducationalBackgroundCode");
migrationBuilder.CreateIndex(
name: "IX_User_PersonalIdentityCode",
table: "User",
column: "PersonalIdentityCode");
migrationBuilder.AddForeignKey(
name: "FK_User_DictionaryData_EducationalBackgroundCode",
table: "User",
column: "EducationalBackgroundCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_User_DictionaryData_PersonalIdentityCode",
table: "User",
column: "PersonalIdentityCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_UserExpectJob_DictionaryData_ExpectJobCode",
table: "UserExpectJob",
column: "ExpectJobCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_User_DictionaryData_EducationalBackgroundCode",
table: "User");
migrationBuilder.DropForeignKey(
name: "FK_User_DictionaryData_PersonalIdentityCode",
table: "User");
migrationBuilder.DropForeignKey(
name: "FK_UserExpectJob_DictionaryData_ExpectJobCode",
table: "UserExpectJob");
migrationBuilder.DropIndex(
name: "IX_User_EducationalBackgroundCode",
table: "User");
migrationBuilder.DropIndex(
name: "IX_User_PersonalIdentityCode",
table: "User");
migrationBuilder.DropColumn(
name: "EducationalBackgroundCode",
table: "User");
migrationBuilder.DropColumn(
name: "FreeTime",
table: "User");
migrationBuilder.DropColumn(
name: "Height",
table: "User");
migrationBuilder.DropColumn(
name: "JobSeekingStatus",
table: "User");
migrationBuilder.DropColumn(
name: "PersonalIdentityCode",
table: "User");
migrationBuilder.DropColumn(
name: "Weight",
table: "User");
migrationBuilder.DropColumn(
name: "WorkExperience",
table: "User");
migrationBuilder.DropColumn(
name: "WorkSeniority",
table: "User");
migrationBuilder.RenameColumn(
name: "ExpectJobCode",
table: "UserExpectJob",
newName: "PersonalIdentityCode");
migrationBuilder.RenameIndex(
name: "IX_UserExpectJob_ExpectJobCode",
table: "UserExpectJob",
newName: "IX_UserExpectJob_PersonalIdentityCode");
migrationBuilder.AlterColumn(
name: "Code",
table: "UserCredential",
type: "nvarchar(128)",
maxLength: 128,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(128)",
oldMaxLength: 128,
oldNullable: true);
migrationBuilder.CreateTable(
name: "UserResume",
columns: table => new
{
Id = table.Column(type: "uniqueidentifier", nullable: false),
EducationalBackgroundCode = table.Column(type: "nvarchar(128)", nullable: true),
PersonalIdentityCode = table.Column(type: "nvarchar(128)", nullable: true),
UserId = table.Column(type: "uniqueidentifier", nullable: false),
CreatedEnterpriseId = table.Column(type: "uniqueidentifier", nullable: true),
CreatedTime = table.Column(type: "datetimeoffset", nullable: false),
CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
FreeTime = table.Column(type: "int", nullable: true),
Height = table.Column(type: "int", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: false),
JobSeekingStatus = table.Column(type: "int", nullable: true),
Sort = table.Column(type: "int", nullable: false),
TraceId = table.Column(type: "nvarchar(max)", nullable: true),
UpdatedTime = table.Column(type: "datetimeoffset", nullable: true),
UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true),
Weight = table.Column(type: "int", nullable: true),
WorkExperience = table.Column(type: "nvarchar(max)", nullable: true),
WorkSeniority = table.Column(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_UserResume", x => x.Id);
table.ForeignKey(
name: "FK_UserResume_DictionaryData_EducationalBackgroundCode",
column: x => x.EducationalBackgroundCode,
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_UserResume_DictionaryData_PersonalIdentityCode",
column: x => x.PersonalIdentityCode,
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_UserResume_User_UserId",
column: x => x.UserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_UserResume_EducationalBackgroundCode",
table: "UserResume",
column: "EducationalBackgroundCode");
migrationBuilder.CreateIndex(
name: "IX_UserResume_PersonalIdentityCode",
table: "UserResume",
column: "PersonalIdentityCode");
migrationBuilder.CreateIndex(
name: "IX_UserResume_UserId",
table: "UserResume",
column: "UserId");
migrationBuilder.AddForeignKey(
name: "FK_UserExpectJob_DictionaryData_PersonalIdentityCode",
table: "UserExpectJob",
column: "PersonalIdentityCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
}
}
}