hrms-api-backend/BMA.EHR.Infrastructure/Migrations/20240528150703_update table RetirementProfile add root.cs
2024-05-29 16:29:12 +07:00

431 lines
16 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableRetirementProfileaddroot : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_RetirementProfiles_Profiles_ProfileId",
table: "RetirementProfiles");
migrationBuilder.DropIndex(
name: "IX_RetirementProfiles_ProfileId",
table: "RetirementProfiles");
migrationBuilder.RenameColumn(
name: "ProfileId",
table: "RetirementProfiles",
newName: "profileId");
migrationBuilder.AlterColumn<string>(
name: "profileId",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "profile Id",
oldClrType: typeof(Guid),
oldType: "char(36)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "child1",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน child1 ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child1Id",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child1 ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child1ShortName",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน child1 ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child2",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน child2 ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child2Id",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child2 ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child2ShortName",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน child2 ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child3",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน child3 ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child3Id",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child3 ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child3ShortName",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน child3 ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child4",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน child4 ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child4Id",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child4 ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child4ShortName",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน child4 ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "citizenId",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "เลขบัตรประชาชน")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "firstName",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "lastName",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "นามสกุล")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posExecutiveId",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "id ตำแหน่งทางการบริหาร ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posExecutiveName",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อตำแหน่งทางการบริหาร ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posLevelId",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "id ระดับตำแหน่ง ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posLevelName",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อระดับตำแหน่ง ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "posLevelRank",
table: "RetirementProfiles",
type: "int",
nullable: true,
comment: "ลำดับระดับตำแหน่ง ");
migrationBuilder.AddColumn<int>(
name: "posMasterNo",
table: "RetirementProfiles",
type: "int",
nullable: true,
comment: "เลขที่ตำแหน่ง ");
migrationBuilder.AddColumn<string>(
name: "posNo",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "เลขที่ตำแหน่ง ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posTypeId",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "id ประเภทตำแหน่ง ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posTypeName",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อประเภทตำแหน่ง ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "posTypeRank",
table: "RetirementProfiles",
type: "int",
nullable: true,
comment: "ลำดับประเภทตำแหน่ง ");
migrationBuilder.AddColumn<string>(
name: "position",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อตำแหน่งในสายงาน ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "prefix",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "คำนำหน้า")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "root",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน root ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "rootId",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน root ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "rootShortName",
table: "RetirementProfiles",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน root ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "child1",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "child1Id",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "child1ShortName",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "child2",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "child2Id",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "child2ShortName",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "child3",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "child3Id",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "child3ShortName",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "child4",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "child4Id",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "child4ShortName",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "citizenId",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "firstName",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "lastName",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "posExecutiveId",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "posExecutiveName",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "posLevelId",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "posLevelName",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "posLevelRank",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "posMasterNo",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "posNo",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "posTypeId",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "posTypeName",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "posTypeRank",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "position",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "prefix",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "root",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "rootId",
table: "RetirementProfiles");
migrationBuilder.DropColumn(
name: "rootShortName",
table: "RetirementProfiles");
migrationBuilder.RenameColumn(
name: "profileId",
table: "RetirementProfiles",
newName: "ProfileId");
migrationBuilder.AlterColumn<Guid>(
name: "ProfileId",
table: "RetirementProfiles",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "profile Id")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_RetirementProfiles_ProfileId",
table: "RetirementProfiles",
column: "ProfileId");
migrationBuilder.AddForeignKey(
name: "FK_RetirementProfiles_Profiles_ProfileId",
table: "RetirementProfiles",
column: "ProfileId",
principalTable: "Profiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}