using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BMA.EHR.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class updatetableRetirementResignsaddchild : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_RetirementResigns_Profiles_ProfileId",
                table: "RetirementResigns");

            migrationBuilder.DropIndex(
                name: "IX_RetirementResigns_ProfileId",
                table: "RetirementResigns");

            migrationBuilder.RenameColumn(
                name: "ProfileId",
                table: "RetirementResigns",
                newName: "profileId");

            migrationBuilder.AlterColumn<string>(
                name: "profileId",
                table: "RetirementResigns",
                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: "OrganizationOld",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "สังกัดเดิม")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "PositionOld",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ตำแหน่งเดิม")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "child1",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อหน่วยงาน child1")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "child1Id",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "id หน่วยงาน child1")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "child1ShortName",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อย่อหน่วยงาน child1")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "child2",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อหน่วยงาน child2")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "child2Id",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "id หน่วยงาน child2")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "child2ShortName",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อย่อหน่วยงาน child2")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "child3",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อหน่วยงาน child3")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "child3Id",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "id หน่วยงาน child3")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "child3ShortName",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อย่อหน่วยงาน child3")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "child4",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อหน่วยงาน child4")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "child4Id",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "id หน่วยงาน child4")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "child4ShortName",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อย่อหน่วยงาน child4")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "citizenId",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "เลขบัตรประชาชน")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "firstName",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อ")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "lastName",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "นามสกุล")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "posLevelId",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "id ระดับตำแหน่ง")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "posLevelName",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อระดับตำแหน่ง")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<int>(
                name: "posMasterNo",
                table: "RetirementResigns",
                type: "int",
                nullable: true,
                comment: "เลขที่ตำแหน่ง");

            migrationBuilder.AddColumn<string>(
                name: "posTypeId",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "id ประเภทตำแหน่ง")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "posTypeName",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อประเภทตำแหน่ง")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "position",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อตำแหน่งในสายงาน")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "prefix",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "คำนำหน้า")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "root",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อหน่วยงาน root")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "rootId",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "id หน่วยงาน root")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "rootShortName",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ชื่อย่อหน่วยงาน root")
                .Annotation("MySql:CharSet", "utf8mb4");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "OrganizationOld",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "PositionOld",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "child1",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "child1Id",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "child1ShortName",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "child2",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "child2Id",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "child2ShortName",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "child3",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "child3Id",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "child3ShortName",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "child4",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "child4Id",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "child4ShortName",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "citizenId",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "firstName",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "lastName",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "posLevelId",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "posLevelName",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "posMasterNo",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "posTypeId",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "posTypeName",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "position",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "prefix",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "root",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "rootId",
                table: "RetirementResigns");

            migrationBuilder.DropColumn(
                name: "rootShortName",
                table: "RetirementResigns");

            migrationBuilder.RenameColumn(
                name: "profileId",
                table: "RetirementResigns",
                newName: "ProfileId");

            migrationBuilder.AlterColumn<Guid>(
                name: "ProfileId",
                table: "RetirementResigns",
                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_RetirementResigns_ProfileId",
                table: "RetirementResigns",
                column: "ProfileId");

            migrationBuilder.AddForeignKey(
                name: "FK_RetirementResigns_Profiles_ProfileId",
                table: "RetirementResigns",
                column: "ProfileId",
                principalTable: "Profiles",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
