hrms-api-backend/BMA.EHR.Infrastructure/Migrations/20240516093353_update table placement Add prefix.cs
2024-05-16 17:00:47 +07:00

715 lines
28 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableplacementAddprefix : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_BloodGroups_BloodGroupId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_Districts_CitizenDistrictId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_Districts_CurrentDistrictId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_Districts_RegistDistrictId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_Genders_GenderId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_Prefixes_FatherPrefixId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_Prefixes_MarryPrefixId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_Prefixes_MotherPrefixId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_Prefixes_PrefixId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_Provinces_CitizenProvinceId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_Provinces_CurrentProvinceId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_Provinces_RegistProvinceId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_Relationships_RelationshipId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_Religions_ReligionId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_SubDistricts_CurrentSubDistrictId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_SubDistricts_RegistSubDistrictId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_BloodGroupId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_CitizenDistrictId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_CitizenProvinceId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_CurrentDistrictId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_CurrentProvinceId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_CurrentSubDistrictId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_FatherPrefixId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_GenderId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_MarryPrefixId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_MotherPrefixId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_PrefixId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_RegistDistrictId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_RegistProvinceId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_RegistSubDistrictId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_RelationshipId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_ReligionId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "BloodGroupId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "FatherPrefixId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "GenderId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "MarryPrefixId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "MotherPrefixId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "PrefixId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "RelationshipId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "ReligionId",
table: "PlacementProfiles");
migrationBuilder.AlterColumn<string>(
name: "RegistSubDistrictId",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id ตำบลที่อยู่ตามทะเบียนบ้าน",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<string>(
name: "RegistProvinceId",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id จังหวัดที่อยู่ตามทะเบียนบ้าน",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<string>(
name: "RegistDistrictId",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id อำเภอที่อยู่ตามทะเบียนบ้าน",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<string>(
name: "CurrentSubDistrictId",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id ตำบลที่อยู่ปัจจุบัน",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<string>(
name: "CurrentProvinceId",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id จังหวัดที่อยู่ปัจจุบัน",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<string>(
name: "CurrentDistrictId",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id อำเภอที่อยู่ปัจจุบัน",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<string>(
name: "CitizenProvinceId",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id จังหวัดที่ออกบัตรประชาชน",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<string>(
name: "CitizenDistrictId",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id เขตที่ออกบัตรประชาชน",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "BloodGroup",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id กลุ่มเลือด")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "FatherPrefix",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id คำนำหน้าชื่อบิดา")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Gender",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id เพศ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "MarryPrefix",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id คำนำหน้าชื่อคู่สมรส")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "MotherPrefix",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id คำนำหน้าชื่อมารดา")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Prefix",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id คำนำหน้า")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Relationship",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id สถานภาพ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Religion",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "Id ศาสนา")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "BloodGroup",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "FatherPrefix",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "Gender",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "MarryPrefix",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "MotherPrefix",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "Prefix",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "Relationship",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "Religion",
table: "PlacementProfiles");
migrationBuilder.AlterColumn<Guid>(
name: "RegistSubDistrictId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "Id ตำบลที่อยู่ตามทะเบียนบ้าน")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<Guid>(
name: "RegistProvinceId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "Id จังหวัดที่อยู่ตามทะเบียนบ้าน")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<Guid>(
name: "RegistDistrictId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "Id อำเภอที่อยู่ตามทะเบียนบ้าน")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<Guid>(
name: "CurrentSubDistrictId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "Id ตำบลที่อยู่ปัจจุบัน")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<Guid>(
name: "CurrentProvinceId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "Id จังหวัดที่อยู่ปัจจุบัน")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<Guid>(
name: "CurrentDistrictId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "Id อำเภอที่อยู่ปัจจุบัน")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<Guid>(
name: "CitizenProvinceId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "Id จังหวัดที่ออกบัตรประชาชน")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<Guid>(
name: "CitizenDistrictId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "Id เขตที่ออกบัตรประชาชน")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<Guid>(
name: "BloodGroupId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "FatherPrefixId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "GenderId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "MarryPrefixId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "MotherPrefixId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "PrefixId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "RelationshipId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "ReligionId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_BloodGroupId",
table: "PlacementProfiles",
column: "BloodGroupId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_CitizenDistrictId",
table: "PlacementProfiles",
column: "CitizenDistrictId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_CitizenProvinceId",
table: "PlacementProfiles",
column: "CitizenProvinceId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_CurrentDistrictId",
table: "PlacementProfiles",
column: "CurrentDistrictId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_CurrentProvinceId",
table: "PlacementProfiles",
column: "CurrentProvinceId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_CurrentSubDistrictId",
table: "PlacementProfiles",
column: "CurrentSubDistrictId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_FatherPrefixId",
table: "PlacementProfiles",
column: "FatherPrefixId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_GenderId",
table: "PlacementProfiles",
column: "GenderId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_MarryPrefixId",
table: "PlacementProfiles",
column: "MarryPrefixId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_MotherPrefixId",
table: "PlacementProfiles",
column: "MotherPrefixId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_PrefixId",
table: "PlacementProfiles",
column: "PrefixId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_RegistDistrictId",
table: "PlacementProfiles",
column: "RegistDistrictId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_RegistProvinceId",
table: "PlacementProfiles",
column: "RegistProvinceId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_RegistSubDistrictId",
table: "PlacementProfiles",
column: "RegistSubDistrictId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_RelationshipId",
table: "PlacementProfiles",
column: "RelationshipId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_ReligionId",
table: "PlacementProfiles",
column: "ReligionId");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_BloodGroups_BloodGroupId",
table: "PlacementProfiles",
column: "BloodGroupId",
principalTable: "BloodGroups",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_Districts_CitizenDistrictId",
table: "PlacementProfiles",
column: "CitizenDistrictId",
principalTable: "Districts",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_Districts_CurrentDistrictId",
table: "PlacementProfiles",
column: "CurrentDistrictId",
principalTable: "Districts",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_Districts_RegistDistrictId",
table: "PlacementProfiles",
column: "RegistDistrictId",
principalTable: "Districts",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_Genders_GenderId",
table: "PlacementProfiles",
column: "GenderId",
principalTable: "Genders",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_Prefixes_FatherPrefixId",
table: "PlacementProfiles",
column: "FatherPrefixId",
principalTable: "Prefixes",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_Prefixes_MarryPrefixId",
table: "PlacementProfiles",
column: "MarryPrefixId",
principalTable: "Prefixes",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_Prefixes_MotherPrefixId",
table: "PlacementProfiles",
column: "MotherPrefixId",
principalTable: "Prefixes",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_Prefixes_PrefixId",
table: "PlacementProfiles",
column: "PrefixId",
principalTable: "Prefixes",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_Provinces_CitizenProvinceId",
table: "PlacementProfiles",
column: "CitizenProvinceId",
principalTable: "Provinces",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_Provinces_CurrentProvinceId",
table: "PlacementProfiles",
column: "CurrentProvinceId",
principalTable: "Provinces",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_Provinces_RegistProvinceId",
table: "PlacementProfiles",
column: "RegistProvinceId",
principalTable: "Provinces",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_Relationships_RelationshipId",
table: "PlacementProfiles",
column: "RelationshipId",
principalTable: "Relationships",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_Religions_ReligionId",
table: "PlacementProfiles",
column: "ReligionId",
principalTable: "Religions",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_SubDistricts_CurrentSubDistrictId",
table: "PlacementProfiles",
column: "CurrentSubDistrictId",
principalTable: "SubDistricts",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_SubDistricts_RegistSubDistrictId",
table: "PlacementProfiles",
column: "RegistSubDistrictId",
principalTable: "SubDistricts",
principalColumn: "Id");
}
}
}