using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FlexJobApi.Database.Migrations.Migrations
{
///
public partial class UpdateDictionaryData : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Enterprise_DictionaryData_CityId",
table: "Enterprise");
migrationBuilder.DropForeignKey(
name: "FK_Enterprise_DictionaryData_IndustryTypeId",
table: "Enterprise");
migrationBuilder.DropForeignKey(
name: "FK_Enterprise_DictionaryData_ProvinceId",
table: "Enterprise");
migrationBuilder.DropForeignKey(
name: "FK_TaskInfo_DictionaryData_CityId",
table: "TaskInfo");
migrationBuilder.DropForeignKey(
name: "FK_TaskInfoBenefit_DictionaryData_BenefitId",
table: "TaskInfoBenefit");
migrationBuilder.DropForeignKey(
name: "FK_TaskInfoCredentialLimit_DictionaryData_TypeId",
table: "TaskInfoCredentialLimit");
migrationBuilder.DropForeignKey(
name: "FK_UserInfo_DictionaryData_CityId",
table: "UserInfo");
migrationBuilder.DropForeignKey(
name: "FK_UserInfo_DictionaryData_EducationalBackgroundId",
table: "UserInfo");
migrationBuilder.DropForeignKey(
name: "FK_UserInfo_DictionaryData_PersonalIdentityId",
table: "UserInfo");
migrationBuilder.DropForeignKey(
name: "FK_UserInfo_DictionaryData_ProvinceId",
table: "UserInfo");
migrationBuilder.DropForeignKey(
name: "FK_UserInfoCredential_DictionaryData_TypeId",
table: "UserInfoCredential");
migrationBuilder.DropForeignKey(
name: "FK_UserInfoExpectJob_DictionaryData_PersonalIdentityId",
table: "UserInfoExpectJob");
migrationBuilder.DropIndex(
name: "IX_UserInfoExpectJob_PersonalIdentityId",
table: "UserInfoExpectJob");
migrationBuilder.DropIndex(
name: "IX_UserInfoCredential_TypeId",
table: "UserInfoCredential");
migrationBuilder.DropIndex(
name: "IX_UserInfo_CityId",
table: "UserInfo");
migrationBuilder.DropIndex(
name: "IX_UserInfo_EducationalBackgroundId",
table: "UserInfo");
migrationBuilder.DropIndex(
name: "IX_UserInfo_PersonalIdentityId",
table: "UserInfo");
migrationBuilder.DropIndex(
name: "IX_UserInfo_ProvinceId",
table: "UserInfo");
migrationBuilder.DropIndex(
name: "IX_TaskInfoCredentialLimit_TypeId",
table: "TaskInfoCredentialLimit");
migrationBuilder.DropIndex(
name: "IX_TaskInfoBenefit_BenefitId",
table: "TaskInfoBenefit");
migrationBuilder.DropIndex(
name: "IX_TaskInfo_CityId",
table: "TaskInfo");
migrationBuilder.DropIndex(
name: "IX_Enterprise_CityId",
table: "Enterprise");
migrationBuilder.DropIndex(
name: "IX_Enterprise_IndustryTypeId",
table: "Enterprise");
migrationBuilder.DropIndex(
name: "IX_Enterprise_ProvinceId",
table: "Enterprise");
migrationBuilder.DropColumn(
name: "PersonalIdentityId",
table: "UserInfoExpectJob");
migrationBuilder.DropColumn(
name: "TypeId",
table: "UserInfoCredential");
migrationBuilder.DropColumn(
name: "CityId",
table: "UserInfo");
migrationBuilder.DropColumn(
name: "EducationalBackgroundId",
table: "UserInfo");
migrationBuilder.DropColumn(
name: "PersonalIdentityId",
table: "UserInfo");
migrationBuilder.DropColumn(
name: "ProvinceId",
table: "UserInfo");
migrationBuilder.DropColumn(
name: "TypeId",
table: "TaskInfoCredentialLimit");
migrationBuilder.DropColumn(
name: "BenefitId",
table: "TaskInfoBenefit");
migrationBuilder.DropColumn(
name: "CityId",
table: "TaskInfo");
migrationBuilder.DropColumn(
name: "CityId",
table: "Enterprise");
migrationBuilder.DropColumn(
name: "IndustryTypeId",
table: "Enterprise");
migrationBuilder.DropColumn(
name: "ProvinceId",
table: "Enterprise");
migrationBuilder.AddColumn(
name: "PersonalIdentityCode",
table: "UserInfoExpectJob",
type: "nvarchar(128)",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn(
name: "TypeCode",
table: "UserInfoCredential",
type: "nvarchar(128)",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn(
name: "CityCode",
table: "UserInfo",
type: "nvarchar(128)",
nullable: true);
migrationBuilder.AddColumn(
name: "EducationalBackgroundCode",
table: "UserInfo",
type: "nvarchar(128)",
nullable: true);
migrationBuilder.AddColumn(
name: "PersonalIdentityCode",
table: "UserInfo",
type: "nvarchar(128)",
nullable: true);
migrationBuilder.AddColumn(
name: "ProvinceCode",
table: "UserInfo",
type: "nvarchar(128)",
nullable: true);
migrationBuilder.AddColumn(
name: "TypeCode",
table: "TaskInfoCredentialLimit",
type: "nvarchar(128)",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn(
name: "BenefitCode",
table: "TaskInfoBenefit",
type: "nvarchar(128)",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn(
name: "CityCode",
table: "TaskInfo",
type: "nvarchar(128)",
nullable: true);
migrationBuilder.AddColumn(
name: "ProvinceCode",
table: "TaskInfo",
type: "nvarchar(128)",
nullable: true);
migrationBuilder.AddColumn(
name: "CityCode",
table: "Enterprise",
type: "nvarchar(128)",
nullable: true);
migrationBuilder.AddColumn(
name: "IndustryTypeCode",
table: "Enterprise",
type: "nvarchar(128)",
nullable: true);
migrationBuilder.AddColumn(
name: "ProvinceCode",
table: "Enterprise",
type: "nvarchar(128)",
nullable: true);
migrationBuilder.AlterColumn(
name: "Code",
table: "DictionaryData",
type: "nvarchar(128)",
maxLength: 128,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(128)",
oldMaxLength: 128,
oldNullable: true);
migrationBuilder.AddUniqueConstraint(
name: "AK_DictionaryData_Code",
table: "DictionaryData",
column: "Code");
migrationBuilder.UpdateData(
table: "UserInfo",
keyColumn: "Id",
keyValue: new Guid("11111111-1111-1111-1111-111111111112"),
columns: new[] { "CityCode", "EducationalBackgroundCode", "PersonalIdentityCode", "ProvinceCode" },
values: new object[] { null, null, null, null });
migrationBuilder.CreateIndex(
name: "IX_UserInfoExpectJob_PersonalIdentityCode",
table: "UserInfoExpectJob",
column: "PersonalIdentityCode");
migrationBuilder.CreateIndex(
name: "IX_UserInfoCredential_TypeCode",
table: "UserInfoCredential",
column: "TypeCode");
migrationBuilder.CreateIndex(
name: "IX_UserInfo_CityCode",
table: "UserInfo",
column: "CityCode");
migrationBuilder.CreateIndex(
name: "IX_UserInfo_EducationalBackgroundCode",
table: "UserInfo",
column: "EducationalBackgroundCode");
migrationBuilder.CreateIndex(
name: "IX_UserInfo_PersonalIdentityCode",
table: "UserInfo",
column: "PersonalIdentityCode");
migrationBuilder.CreateIndex(
name: "IX_UserInfo_ProvinceCode",
table: "UserInfo",
column: "ProvinceCode");
migrationBuilder.CreateIndex(
name: "IX_TaskInfoCredentialLimit_TypeCode",
table: "TaskInfoCredentialLimit",
column: "TypeCode");
migrationBuilder.CreateIndex(
name: "IX_TaskInfoBenefit_BenefitCode",
table: "TaskInfoBenefit",
column: "BenefitCode");
migrationBuilder.CreateIndex(
name: "IX_TaskInfo_CityCode",
table: "TaskInfo",
column: "CityCode");
migrationBuilder.CreateIndex(
name: "IX_TaskInfo_ProvinceCode",
table: "TaskInfo",
column: "ProvinceCode");
migrationBuilder.CreateIndex(
name: "IX_Enterprise_CityCode",
table: "Enterprise",
column: "CityCode");
migrationBuilder.CreateIndex(
name: "IX_Enterprise_IndustryTypeCode",
table: "Enterprise",
column: "IndustryTypeCode");
migrationBuilder.CreateIndex(
name: "IX_Enterprise_ProvinceCode",
table: "Enterprise",
column: "ProvinceCode");
migrationBuilder.CreateIndex(
name: "IX_DictionaryData_Code",
table: "DictionaryData",
column: "Code",
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_Enterprise_DictionaryData_CityCode",
table: "Enterprise",
column: "CityCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Enterprise_DictionaryData_IndustryTypeCode",
table: "Enterprise",
column: "IndustryTypeCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Enterprise_DictionaryData_ProvinceCode",
table: "Enterprise",
column: "ProvinceCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_TaskInfo_DictionaryData_CityCode",
table: "TaskInfo",
column: "CityCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_TaskInfo_DictionaryData_ProvinceCode",
table: "TaskInfo",
column: "ProvinceCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_TaskInfoBenefit_DictionaryData_BenefitCode",
table: "TaskInfoBenefit",
column: "BenefitCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_TaskInfoCredentialLimit_DictionaryData_TypeCode",
table: "TaskInfoCredentialLimit",
column: "TypeCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_UserInfo_DictionaryData_CityCode",
table: "UserInfo",
column: "CityCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_UserInfo_DictionaryData_EducationalBackgroundCode",
table: "UserInfo",
column: "EducationalBackgroundCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_UserInfo_DictionaryData_PersonalIdentityCode",
table: "UserInfo",
column: "PersonalIdentityCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_UserInfo_DictionaryData_ProvinceCode",
table: "UserInfo",
column: "ProvinceCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_UserInfoCredential_DictionaryData_TypeCode",
table: "UserInfoCredential",
column: "TypeCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_UserInfoExpectJob_DictionaryData_PersonalIdentityCode",
table: "UserInfoExpectJob",
column: "PersonalIdentityCode",
principalTable: "DictionaryData",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Enterprise_DictionaryData_CityCode",
table: "Enterprise");
migrationBuilder.DropForeignKey(
name: "FK_Enterprise_DictionaryData_IndustryTypeCode",
table: "Enterprise");
migrationBuilder.DropForeignKey(
name: "FK_Enterprise_DictionaryData_ProvinceCode",
table: "Enterprise");
migrationBuilder.DropForeignKey(
name: "FK_TaskInfo_DictionaryData_CityCode",
table: "TaskInfo");
migrationBuilder.DropForeignKey(
name: "FK_TaskInfo_DictionaryData_ProvinceCode",
table: "TaskInfo");
migrationBuilder.DropForeignKey(
name: "FK_TaskInfoBenefit_DictionaryData_BenefitCode",
table: "TaskInfoBenefit");
migrationBuilder.DropForeignKey(
name: "FK_TaskInfoCredentialLimit_DictionaryData_TypeCode",
table: "TaskInfoCredentialLimit");
migrationBuilder.DropForeignKey(
name: "FK_UserInfo_DictionaryData_CityCode",
table: "UserInfo");
migrationBuilder.DropForeignKey(
name: "FK_UserInfo_DictionaryData_EducationalBackgroundCode",
table: "UserInfo");
migrationBuilder.DropForeignKey(
name: "FK_UserInfo_DictionaryData_PersonalIdentityCode",
table: "UserInfo");
migrationBuilder.DropForeignKey(
name: "FK_UserInfo_DictionaryData_ProvinceCode",
table: "UserInfo");
migrationBuilder.DropForeignKey(
name: "FK_UserInfoCredential_DictionaryData_TypeCode",
table: "UserInfoCredential");
migrationBuilder.DropForeignKey(
name: "FK_UserInfoExpectJob_DictionaryData_PersonalIdentityCode",
table: "UserInfoExpectJob");
migrationBuilder.DropIndex(
name: "IX_UserInfoExpectJob_PersonalIdentityCode",
table: "UserInfoExpectJob");
migrationBuilder.DropIndex(
name: "IX_UserInfoCredential_TypeCode",
table: "UserInfoCredential");
migrationBuilder.DropIndex(
name: "IX_UserInfo_CityCode",
table: "UserInfo");
migrationBuilder.DropIndex(
name: "IX_UserInfo_EducationalBackgroundCode",
table: "UserInfo");
migrationBuilder.DropIndex(
name: "IX_UserInfo_PersonalIdentityCode",
table: "UserInfo");
migrationBuilder.DropIndex(
name: "IX_UserInfo_ProvinceCode",
table: "UserInfo");
migrationBuilder.DropIndex(
name: "IX_TaskInfoCredentialLimit_TypeCode",
table: "TaskInfoCredentialLimit");
migrationBuilder.DropIndex(
name: "IX_TaskInfoBenefit_BenefitCode",
table: "TaskInfoBenefit");
migrationBuilder.DropIndex(
name: "IX_TaskInfo_CityCode",
table: "TaskInfo");
migrationBuilder.DropIndex(
name: "IX_TaskInfo_ProvinceCode",
table: "TaskInfo");
migrationBuilder.DropIndex(
name: "IX_Enterprise_CityCode",
table: "Enterprise");
migrationBuilder.DropIndex(
name: "IX_Enterprise_IndustryTypeCode",
table: "Enterprise");
migrationBuilder.DropIndex(
name: "IX_Enterprise_ProvinceCode",
table: "Enterprise");
migrationBuilder.DropUniqueConstraint(
name: "AK_DictionaryData_Code",
table: "DictionaryData");
migrationBuilder.DropIndex(
name: "IX_DictionaryData_Code",
table: "DictionaryData");
migrationBuilder.DropColumn(
name: "PersonalIdentityCode",
table: "UserInfoExpectJob");
migrationBuilder.DropColumn(
name: "TypeCode",
table: "UserInfoCredential");
migrationBuilder.DropColumn(
name: "CityCode",
table: "UserInfo");
migrationBuilder.DropColumn(
name: "EducationalBackgroundCode",
table: "UserInfo");
migrationBuilder.DropColumn(
name: "PersonalIdentityCode",
table: "UserInfo");
migrationBuilder.DropColumn(
name: "ProvinceCode",
table: "UserInfo");
migrationBuilder.DropColumn(
name: "TypeCode",
table: "TaskInfoCredentialLimit");
migrationBuilder.DropColumn(
name: "BenefitCode",
table: "TaskInfoBenefit");
migrationBuilder.DropColumn(
name: "CityCode",
table: "TaskInfo");
migrationBuilder.DropColumn(
name: "ProvinceCode",
table: "TaskInfo");
migrationBuilder.DropColumn(
name: "CityCode",
table: "Enterprise");
migrationBuilder.DropColumn(
name: "IndustryTypeCode",
table: "Enterprise");
migrationBuilder.DropColumn(
name: "ProvinceCode",
table: "Enterprise");
migrationBuilder.AddColumn(
name: "PersonalIdentityId",
table: "UserInfoExpectJob",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn(
name: "TypeId",
table: "UserInfoCredential",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn(
name: "CityId",
table: "UserInfo",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn(
name: "EducationalBackgroundId",
table: "UserInfo",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn(
name: "PersonalIdentityId",
table: "UserInfo",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn(
name: "ProvinceId",
table: "UserInfo",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn(
name: "TypeId",
table: "TaskInfoCredentialLimit",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn(
name: "BenefitId",
table: "TaskInfoBenefit",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn(
name: "CityId",
table: "TaskInfo",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn(
name: "CityId",
table: "Enterprise",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn(
name: "IndustryTypeId",
table: "Enterprise",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn(
name: "ProvinceId",
table: "Enterprise",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AlterColumn(
name: "Code",
table: "DictionaryData",
type: "nvarchar(128)",
maxLength: 128,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(128)",
oldMaxLength: 128);
migrationBuilder.UpdateData(
table: "UserInfo",
keyColumn: "Id",
keyValue: new Guid("11111111-1111-1111-1111-111111111112"),
columns: new[] { "CityId", "EducationalBackgroundId", "PersonalIdentityId", "ProvinceId" },
values: new object[] { null, null, null, null });
migrationBuilder.CreateIndex(
name: "IX_UserInfoExpectJob_PersonalIdentityId",
table: "UserInfoExpectJob",
column: "PersonalIdentityId");
migrationBuilder.CreateIndex(
name: "IX_UserInfoCredential_TypeId",
table: "UserInfoCredential",
column: "TypeId");
migrationBuilder.CreateIndex(
name: "IX_UserInfo_CityId",
table: "UserInfo",
column: "CityId");
migrationBuilder.CreateIndex(
name: "IX_UserInfo_EducationalBackgroundId",
table: "UserInfo",
column: "EducationalBackgroundId");
migrationBuilder.CreateIndex(
name: "IX_UserInfo_PersonalIdentityId",
table: "UserInfo",
column: "PersonalIdentityId");
migrationBuilder.CreateIndex(
name: "IX_UserInfo_ProvinceId",
table: "UserInfo",
column: "ProvinceId");
migrationBuilder.CreateIndex(
name: "IX_TaskInfoCredentialLimit_TypeId",
table: "TaskInfoCredentialLimit",
column: "TypeId");
migrationBuilder.CreateIndex(
name: "IX_TaskInfoBenefit_BenefitId",
table: "TaskInfoBenefit",
column: "BenefitId");
migrationBuilder.CreateIndex(
name: "IX_TaskInfo_CityId",
table: "TaskInfo",
column: "CityId");
migrationBuilder.CreateIndex(
name: "IX_Enterprise_CityId",
table: "Enterprise",
column: "CityId");
migrationBuilder.CreateIndex(
name: "IX_Enterprise_IndustryTypeId",
table: "Enterprise",
column: "IndustryTypeId");
migrationBuilder.CreateIndex(
name: "IX_Enterprise_ProvinceId",
table: "Enterprise",
column: "ProvinceId");
migrationBuilder.AddForeignKey(
name: "FK_Enterprise_DictionaryData_CityId",
table: "Enterprise",
column: "CityId",
principalTable: "DictionaryData",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Enterprise_DictionaryData_IndustryTypeId",
table: "Enterprise",
column: "IndustryTypeId",
principalTable: "DictionaryData",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Enterprise_DictionaryData_ProvinceId",
table: "Enterprise",
column: "ProvinceId",
principalTable: "DictionaryData",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_TaskInfo_DictionaryData_CityId",
table: "TaskInfo",
column: "CityId",
principalTable: "DictionaryData",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_TaskInfoBenefit_DictionaryData_BenefitId",
table: "TaskInfoBenefit",
column: "BenefitId",
principalTable: "DictionaryData",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_TaskInfoCredentialLimit_DictionaryData_TypeId",
table: "TaskInfoCredentialLimit",
column: "TypeId",
principalTable: "DictionaryData",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UserInfo_DictionaryData_CityId",
table: "UserInfo",
column: "CityId",
principalTable: "DictionaryData",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UserInfo_DictionaryData_EducationalBackgroundId",
table: "UserInfo",
column: "EducationalBackgroundId",
principalTable: "DictionaryData",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UserInfo_DictionaryData_PersonalIdentityId",
table: "UserInfo",
column: "PersonalIdentityId",
principalTable: "DictionaryData",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UserInfo_DictionaryData_ProvinceId",
table: "UserInfo",
column: "ProvinceId",
principalTable: "DictionaryData",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UserInfoCredential_DictionaryData_TypeId",
table: "UserInfoCredential",
column: "TypeId",
principalTable: "DictionaryData",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UserInfoExpectJob_DictionaryData_PersonalIdentityId",
table: "UserInfoExpectJob",
column: "PersonalIdentityId",
principalTable: "DictionaryData",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}