using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BMA.EHR.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class addtableRetirementRawProfile : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "RetirementRawProfiles",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
                    CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
                    LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Order = table.Column<int>(type: "int", nullable: false, comment: "ลำดับที่"),
                    Reason = table.Column<string>(type: "longtext", nullable: false, comment: "เหตุผล")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remove = table.Column<string>(type: "longtext", nullable: false, comment: "ลบออกจากเกษียญ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RetirementPeriodId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    profileId = table.Column<string>(type: "longtext", nullable: true, comment: "profile Id")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    prefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้า")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    firstName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    lastName = table.Column<string>(type: "longtext", nullable: true, comment: "นามสกุล")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    citizenId = table.Column<string>(type: "longtext", nullable: true, comment: "เลขบัตรประชาชน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    root = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน root ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    rootId = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน root ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    rootShortName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน root ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    child1 = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child1 ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    child1Id = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน child1 ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    child1ShortName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child1 ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    child2 = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child2 ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    child2Id = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน child2 ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    child2ShortName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child2 ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    child3 = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child3 ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    child3Id = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน child3 ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    child3ShortName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child3 ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    child4 = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child4 ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    child4Id = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน child4 ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    child4ShortName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child4 ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    posMasterNo = table.Column<int>(type: "int", nullable: true, comment: "เลขที่ตำแหน่ง "),
                    position = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อตำแหน่งในสายงาน ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    posTypeId = table.Column<string>(type: "longtext", nullable: true, comment: "id ประเภทตำแหน่ง ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    posTypeName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อประเภทตำแหน่ง ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    posTypeRank = table.Column<int>(type: "int", nullable: true, comment: "ลำดับประเภทตำแหน่ง "),
                    posLevelId = table.Column<string>(type: "longtext", nullable: true, comment: "id ระดับตำแหน่ง ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    posLevelName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อระดับตำแหน่ง ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    posLevelRank = table.Column<int>(type: "int", nullable: true, comment: "ลำดับระดับตำแหน่ง "),
                    posExecutiveId = table.Column<string>(type: "longtext", nullable: true, comment: "id ตำแหน่งทางการบริหาร ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    posExecutiveName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อตำแหน่งทางการบริหาร ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    posNo = table.Column<string>(type: "longtext", nullable: true, comment: "เลขที่ตำแหน่ง ")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RetirementRawProfiles", x => x.Id);
                    table.ForeignKey(
                        name: "FK_RetirementRawProfiles_RetirementPeriods_RetirementPeriodId",
                        column: x => x.RetirementPeriodId,
                        principalTable: "RetirementPeriods",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_RetirementRawProfiles_RetirementPeriodId",
                table: "RetirementRawProfiles",
                column: "RetirementPeriodId");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "RetirementRawProfiles");
        }
    }
}
