using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

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

            // migrationBuilder.DropIndex(
            //     name: "IX_PlacementOfficers_ProfileId",
            //     table: "PlacementOfficers");

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

            migrationBuilder.AlterColumn<string>(
                name: "profileId",
                table: "PlacementOfficers",
                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: "PlacementOfficers",
                type: "longtext",
                nullable: true,
                comment: "ชื่อหน่วยงาน child1")
                .Annotation("MySql:CharSet", "utf8mb4");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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