using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
    /// <inheritdoc />
    public partial class deletetavlemetadata : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AvailablePositionLevels");

            migrationBuilder.DropTable(
                name: "BloodGroups");

            migrationBuilder.DropTable(
                name: "EducationLevels");

            migrationBuilder.DropTable(
                name: "Holidays");

            migrationBuilder.DropTable(
                name: "LimitTypeLeave");

            migrationBuilder.DropTable(
                name: "OrganizationAgencys");

            migrationBuilder.DropTable(
                name: "OrganizationGovernmentAgencys");

            migrationBuilder.DropTable(
                name: "PhysicalStatuses");

            migrationBuilder.DropTable(
                name: "PositionEmployeeStatuses");

            migrationBuilder.DropTable(
                name: "PositionMasterHistoryEntity");

            migrationBuilder.DropTable(
                name: "Positions");

            migrationBuilder.DropTable(
                name: "ProfileAbilityHistory");

            migrationBuilder.DropTable(
                name: "ProfileAddressHistory");

            migrationBuilder.DropTable(
                name: "ProfileAssessmentHistory");

            migrationBuilder.DropTable(
                name: "ProfileAvatarHistory");

            migrationBuilder.DropTable(
                name: "ProfileCertificateHistory");

            migrationBuilder.DropTable(
                name: "ProfileChangeNameHistory");

            migrationBuilder.DropTable(
                name: "ProfileChildrenHistory");

            migrationBuilder.DropTable(
                name: "ProfileCoupleHistory");

            migrationBuilder.DropTable(
                name: "ProfileCurrentAddressHistory");

            migrationBuilder.DropTable(
                name: "ProfileDisciplineHistory");

            migrationBuilder.DropTable(
                name: "ProfileDutyHistory");

            migrationBuilder.DropTable(
                name: "ProfileEducationHistory");

            migrationBuilder.DropTable(
                name: "ProfileEmployment");

            migrationBuilder.DropTable(
                name: "ProfileFatherHistory");

            migrationBuilder.DropTable(
                name: "ProfileGovernmentHistory");

            migrationBuilder.DropTable(
                name: "ProfileHistory");

            migrationBuilder.DropTable(
                name: "ProfileHonorHistory");

            migrationBuilder.DropTable(
                name: "ProfileInsigniaHistory");

            migrationBuilder.DropTable(
                name: "ProfileLeaveHistory");

            migrationBuilder.DropTable(
                name: "ProfileMotherHistory");

            migrationBuilder.DropTable(
                name: "ProfileNopaidHistory");

            migrationBuilder.DropTable(
                name: "ProfileOtherHistory");

            migrationBuilder.DropTable(
                name: "ProfilePaper");

            migrationBuilder.DropTable(
                name: "ProfilePositions");

            migrationBuilder.DropTable(
                name: "ProfileRegistrationAddressHistory");

            migrationBuilder.DropTable(
                name: "ProfileSalaryHistory");

            migrationBuilder.DropTable(
                name: "ProfileTrainingHistory");

            migrationBuilder.DropTable(
                name: "Relationships");

            migrationBuilder.DropTable(
                name: "Religions");

            migrationBuilder.DropTable(
                name: "RoyalHierarchys");

            migrationBuilder.DropTable(
                name: "Royals");

            migrationBuilder.DropTable(
                name: "RoyalTypes");

            migrationBuilder.DropTable(
                name: "SubDistricts");

            migrationBuilder.DropTable(
                name: "ProfileAbility");

            migrationBuilder.DropTable(
                name: "ProfileAssessment");

            migrationBuilder.DropTable(
                name: "ProfileCertificate");

            migrationBuilder.DropTable(
                name: "ProfileChangeName");

            migrationBuilder.DropTable(
                name: "ProfileChildren");

            migrationBuilder.DropTable(
                name: "ProfileFamilyHistory");

            migrationBuilder.DropTable(
                name: "ProfileDiscipline");

            migrationBuilder.DropTable(
                name: "ProfileDuty");

            migrationBuilder.DropTable(
                name: "ProfileEducation");

            migrationBuilder.DropTable(
                name: "ProfileHonor");

            migrationBuilder.DropTable(
                name: "ProfileInsignia");

            migrationBuilder.DropTable(
                name: "ProfileLeave");

            migrationBuilder.DropTable(
                name: "ProfileNopaid");

            migrationBuilder.DropTable(
                name: "ProfileOther");

            migrationBuilder.DropTable(
                name: "OrganizationPositions");

            migrationBuilder.DropTable(
                name: "ProfileSalary");

            migrationBuilder.DropTable(
                name: "ProfileTraining");

            migrationBuilder.DropTable(
                name: "Districts");

            migrationBuilder.DropTable(
                name: "Insignias");

            migrationBuilder.DropTable(
                name: "TypeLeave");

            migrationBuilder.DropTable(
                name: "Organizations");

            migrationBuilder.DropTable(
                name: "PositionMasters");

            migrationBuilder.DropTable(
                name: "Profile");

            migrationBuilder.DropTable(
                name: "Provinces");

            migrationBuilder.DropTable(
                name: "InsigniaTypes");

            migrationBuilder.DropTable(
                name: "OrganizationFaxs");

            migrationBuilder.DropTable(
                name: "OrganizationLevels");

            migrationBuilder.DropTable(
                name: "OrganizationOrganizations");

            migrationBuilder.DropTable(
                name: "OrganizationStatuses");

            migrationBuilder.DropTable(
                name: "OrganizationTelExternals");

            migrationBuilder.DropTable(
                name: "OrganizationTelInternals");

            migrationBuilder.DropTable(
                name: "OrganizationTypes");

            migrationBuilder.DropTable(
                name: "PositionExecutiveSides");

            migrationBuilder.DropTable(
                name: "PositionExecutives");

            migrationBuilder.DropTable(
                name: "PositionLines");

            migrationBuilder.DropTable(
                name: "PositionPathSides");

            migrationBuilder.DropTable(
                name: "PositionStatuss");

            migrationBuilder.DropTable(
                name: "Document");

            migrationBuilder.DropTable(
                name: "Genders");

            migrationBuilder.DropTable(
                name: "LimitLeave");

            migrationBuilder.DropTable(
                name: "PositionEmployeeGroups");

            migrationBuilder.DropTable(
                name: "PositionEmployeeLevels");

            migrationBuilder.DropTable(
                name: "PositionEmployeeLines");

            migrationBuilder.DropTable(
                name: "PositionEmployeePositionSides");

            migrationBuilder.DropTable(
                name: "PositionEmployeePositions");

            migrationBuilder.DropTable(
                name: "PositionLevels");

            migrationBuilder.DropTable(
                name: "PositionNumbers");

            migrationBuilder.DropTable(
                name: "PositionPaths");

            migrationBuilder.DropTable(
                name: "PositionTypes");

            migrationBuilder.DropTable(
                name: "Prefixes");

            migrationBuilder.DropTable(
                name: "OrganizationShortNames");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "BloodGroups",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(2)", maxLength: 2, nullable: false, comment: "ชื่อหมู่โลหิต")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BloodGroups", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Document",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    CreatedDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    Detail = table.Column<string>(type: "text", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FileName = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FileSize = table.Column<int>(type: "int", nullable: false),
                    FileType = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ObjectRefId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Document", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "EducationLevels",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ระดับการศึกษา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EducationLevels", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Genders",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, comment: "เพศ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Genders", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Holidays",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Year = table.Column<int>(type: "int", nullable: false, comment: "ประจำปี"),
                    HolidayDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "วันหยุด"),
                    OriginalDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "วันหยุด(Original)"),
                    Name = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false, comment: "ชื่อวันหยุด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsSpecial = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "เป็นวันหยุดพิเศษหรือไม่"),
                    Category = table.Column<string>(type: "longtext", nullable: false, comment: "ประเภทของวันหยุดสำหรับ ทำงาน 5 วัน=`NORMAL`,ทำงาน 6 วัน=`6DAYS`")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Holidays", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "InsigniaTypes",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "ชื่อประเภทเครื่องราช")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_InsigniaTypes", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "LimitLeave",
                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"),
                    Name = table.Column<string>(type: "longtext", nullable: true, comment: "ยังไม่ชัวใช้อะไรเป็นkey")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LimitLeave", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "OrganizationAgencys",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงานต้นสังกัด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrganizationAgencys", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "OrganizationFaxs",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์โทรสาร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrganizationFaxs", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "OrganizationGovernmentAgencys",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ข้อมูลโครงสร้างหน่วยงานชื่อ ส่วนราชการต้นสังกัด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrganizationGovernmentAgencys", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "OrganizationLevels",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ข้อมูลโครงสร้างหน่วยงานชื่อ ระดับ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrganizationLevels", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "OrganizationOrganizations",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    Note = table.Column<string>(type: "longtext", nullable: false, comment: "หมายเหตุ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrganizationOrganizations", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "OrganizationShortNames",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    AgencyCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสหน่วยงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    GovernmentCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสส่วนราชการ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ข้อมูลโครงสร้างหน่วยงานชื่อ ตัวย่อหน่วยงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    Note = table.Column<string>(type: "longtext", nullable: false, comment: "หมายเหตุ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrganizationShortNames", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "OrganizationStatuses",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ข้อมูลโครงสร้างหน่วยงานชื่อ สถานะ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrganizationStatuses", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "OrganizationTelExternals",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์ติดต่อภายนอก")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrganizationTelExternals", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "OrganizationTelInternals",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์ติดต่อภายใน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrganizationTelInternals", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "OrganizationTypes",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ข้อมูลโครงสร้างหน่วยงานชื่อ ประเภท")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrganizationTypes", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PhysicalStatuses",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "สถานภาพทางกาย")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PhysicalStatuses", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionEmployeeGroups",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อกลุ่มงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionEmployeeGroups", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionEmployeeLevels",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Order = table.Column<int>(type: "int", nullable: true, comment: "ลำดับ"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionEmployeeLevels", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionEmployeeLines",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อสายงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionEmployeeLines", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionEmployeePositions",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    Note = table.Column<string>(type: "longtext", nullable: false, comment: "หมายเหตุ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionEmployeePositions", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionEmployeePositionSides",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อด้านของตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    Note = table.Column<string>(type: "longtext", nullable: false, comment: "หมายเหตุ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionEmployeePositionSides", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionEmployeeStatuses",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อสถานะของตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionEmployeeStatuses", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionExecutives",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อตำแหน่งทางการบริหารของข้อมูลตำแหน่งของข้าราชการ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionExecutives", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionExecutiveSides",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อด้านทางการบริหาร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    Note = table.Column<string>(type: "longtext", nullable: false, comment: "หมายเหตุ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionExecutiveSides", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionLevels",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Order = table.Column<int>(type: "int", nullable: true, comment: "ลำดับ"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อระดับตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ShortName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อย่อระดับตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Level = table.Column<int>(type: "int", nullable: false, comment: "ลำดับชั้นของระดับตำแหน่ง"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionLevels", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionLines",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อสายงานของข้อมูลตำแหน่งของข้าราชการ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionLines", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionPaths",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อสายงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    Note = table.Column<string>(type: "longtext", nullable: false, comment: "หมายเหตุ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionPaths", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionPathSides",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อด้าน/สาขา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    Note = table.Column<string>(type: "longtext", nullable: false, comment: "หมายเหตุ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionPathSides", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionStatuss",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อสถานะของตำแหน่งของข้อมูลตำแหน่งของข้าราชการ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionStatuss", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionTypes",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Order = table.Column<int>(type: "int", nullable: true, comment: "ลำดับ"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อประเภทตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionTypes", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Prefixes",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "รายละเอียดคำนำหน้า")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Prefixes", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Provinces",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: false, comment: "จังหวัด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Provinces", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Relationships",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "ชื่อความสัมพันธ์")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Relationships", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Religions",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ศาสนา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Religions", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "RoyalHierarchys",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อลำดับชั้นข้อมูลเครื่องราชฯ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RoyalHierarchys", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Royals",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อประเภทข้อมูลเหรียญตรา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ShortName = table.Column<string>(type: "varchar(10)", maxLength: 10, nullable: false, comment: "ชื่อย่อเหรียญตรา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Royals", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "RoyalTypes",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อประเภทข้อมูลเครื่องราชฯ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RoyalTypes", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "TypeLeave",
                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"),
                    Name = table.Column<string>(type: "longtext", nullable: true, comment: "ประเภทการลา")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TypeLeave", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Insignias",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อเครื่องราช")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ShortName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "ชื่อย่อเครื่องราช")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    Level = table.Column<int>(type: "int", nullable: false, comment: "ลำดับชั้นของเครื่องราช เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น"),
                    Note = table.Column<string>(type: "longtext", nullable: false, comment: "หมายเหตุ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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"),
                    InsigniaTypeId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Insignias", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Insignias_InsigniaTypes_InsigniaTypeId",
                        column: x => x.InsigniaTypeId,
                        principalTable: "InsigniaTypes",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionNumbers",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "ชื่อ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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"),
                    OrganizationShortNameId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionNumbers", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PositionNumbers_OrganizationShortNames_OrganizationShortName~",
                        column: x => x.OrganizationShortNameId,
                        principalTable: "OrganizationShortNames",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Organizations",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    OrganizationAgencyId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "OrganizationAgencyId", collation: "ascii_general_ci"),
                    OrganizationGovernmentAgencyId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "OrganizationGovernmentAgencyId", collation: "ascii_general_ci"),
                    OrganizationOrder = table.Column<int>(type: "int", nullable: true, comment: "OrganizationOrder"),
                    OrganizationUserNote = table.Column<string>(type: "longtext", nullable: true, comment: "OrganizationUserNote")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Agency = table.Column<string>(type: "longtext", nullable: true, comment: "หน่วยงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Government = table.Column<string>(type: "longtext", nullable: true, comment: "ส่วนราชการ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Department = table.Column<string>(type: "longtext", nullable: true, comment: "ฝ่าย/ส่วน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Pile = table.Column<string>(type: "longtext", nullable: true, comment: "กอง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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"),
                    OrganizationFaxId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    OrganizationLevelId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    OrganizationOrganizationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    OrganizationShortNameId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    OrganizationStatusId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    OrganizationTelExternalId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    OrganizationTelInternalId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    OrganizationTypeId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ParentId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Organizations", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Organizations_OrganizationFaxs_OrganizationFaxId",
                        column: x => x.OrganizationFaxId,
                        principalTable: "OrganizationFaxs",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Organizations_OrganizationLevels_OrganizationLevelId",
                        column: x => x.OrganizationLevelId,
                        principalTable: "OrganizationLevels",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Organizations_OrganizationOrganizations_OrganizationOrganiza~",
                        column: x => x.OrganizationOrganizationId,
                        principalTable: "OrganizationOrganizations",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Organizations_OrganizationShortNames_OrganizationShortNameId",
                        column: x => x.OrganizationShortNameId,
                        principalTable: "OrganizationShortNames",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Organizations_OrganizationStatuses_OrganizationStatusId",
                        column: x => x.OrganizationStatusId,
                        principalTable: "OrganizationStatuses",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Organizations_OrganizationTelExternals_OrganizationTelExtern~",
                        column: x => x.OrganizationTelExternalId,
                        principalTable: "OrganizationTelExternals",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Organizations_OrganizationTelInternals_OrganizationTelIntern~",
                        column: x => x.OrganizationTelInternalId,
                        principalTable: "OrganizationTelInternals",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Organizations_OrganizationTypes_OrganizationTypeId",
                        column: x => x.OrganizationTypeId,
                        principalTable: "OrganizationTypes",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Organizations_Organizations_ParentId",
                        column: x => x.ParentId,
                        principalTable: "Organizations",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionMasters",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    PositionId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "PositionId", collation: "ascii_general_ci"),
                    PositionCondition = table.Column<string>(type: "longtext", nullable: true, comment: "PositionCondition")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionMasterUserNote = table.Column<string>(type: "longtext", nullable: true, comment: "PositionMasterUserNote")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsDirector = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "IsDirector"),
                    Qualification = table.Column<string>(type: "longtext", nullable: true, comment: "คุณวุฒิ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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"),
                    PositionExecutiveId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionExecutiveSideId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionLineId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionPathId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionPathSideId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionStatusId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionTypeId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionExecutiveSideObject = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionPathSideObject = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionMasters", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PositionMasters_PositionExecutiveSides_PositionExecutiveSide~",
                        column: x => x.PositionExecutiveSideId,
                        principalTable: "PositionExecutiveSides",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_PositionMasters_PositionExecutives_PositionExecutiveId",
                        column: x => x.PositionExecutiveId,
                        principalTable: "PositionExecutives",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_PositionMasters_PositionLines_PositionLineId",
                        column: x => x.PositionLineId,
                        principalTable: "PositionLines",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_PositionMasters_PositionPathSides_PositionPathSideId",
                        column: x => x.PositionPathSideId,
                        principalTable: "PositionPathSides",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_PositionMasters_PositionPaths_PositionPathId",
                        column: x => x.PositionPathId,
                        principalTable: "PositionPaths",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_PositionMasters_PositionStatuss_PositionStatusId",
                        column: x => x.PositionStatusId,
                        principalTable: "PositionStatuss",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_PositionMasters_PositionTypes_PositionTypeId",
                        column: x => x.PositionTypeId,
                        principalTable: "PositionTypes",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Positions",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false, comment: "ชื่อตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExecutiveName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false, comment: "ชื่อตำแหน่งทางการบริหาร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionCategory = table.Column<string>(type: "longtext", nullable: false, comment: "ตำแหน่งสำหรับข้าราชการหรือลูกจ้าง officer/employee")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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"),
                    ExecutiveSideId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PathSideId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionLevelId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionPathId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionTypeId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Positions", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Positions_PositionExecutiveSides_ExecutiveSideId",
                        column: x => x.ExecutiveSideId,
                        principalTable: "PositionExecutiveSides",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Positions_PositionLevels_PositionLevelId",
                        column: x => x.PositionLevelId,
                        principalTable: "PositionLevels",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Positions_PositionPathSides_PathSideId",
                        column: x => x.PathSideId,
                        principalTable: "PositionPathSides",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Positions_PositionPaths_PositionPathId",
                        column: x => x.PositionPathId,
                        principalTable: "PositionPaths",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Positions_PositionTypes_PositionTypeId",
                        column: x => x.PositionTypeId,
                        principalTable: "PositionTypes",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Districts",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: false, comment: "เขต/อำเภอ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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"),
                    ProvinceId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Districts", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Districts_Provinces_ProvinceId",
                        column: x => x.ProvinceId,
                        principalTable: "Provinces",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "LimitTypeLeave",
                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"),
                    LimitLeaveId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    TypeLeaveId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    NumLeave = table.Column<double>(type: "double", nullable: true, comment: "จำนวนที่ลาได้")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LimitTypeLeave", x => x.Id);
                    table.ForeignKey(
                        name: "FK_LimitTypeLeave_LimitLeave_LimitLeaveId",
                        column: x => x.LimitLeaveId,
                        principalTable: "LimitLeave",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_LimitTypeLeave_TypeLeave_TypeLeaveId",
                        column: x => x.TypeLeaveId,
                        principalTable: "TypeLeave",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Profile",
                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"),
                    AvatarId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    GenderId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LimitLeaveId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionEmployeeGroupId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionEmployeeLevelId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionEmployeeLineId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionEmployeePositionId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionEmployeePositionSideId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionLevelId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionTypeId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PosNoId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PrefixId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Ability = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AvatarRef = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    BirthDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "วันเกิด"),
                    BloodGroupId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id กลุ่มเลือด", collation: "ascii_general_ci"),
                    CitizenId = table.Column<string>(type: "varchar(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Couple = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "คู่สมรส"),
                    CoupleCareer = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "อาชีพคู่สมรส")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CoupleCitizenId = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "เลขที่บัตรประชาชนคู่สมรส")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CoupleFirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "ชื่อคู่สมรส")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CoupleLastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "นามสกุลคู่สมรส")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CoupleLastNameOld = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "นามสกุลคู่สมรส(เดิม)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CoupleLive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "มีชีวิตคู่สมรส"),
                    CouplePrefixId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id คำนำหน้าคู่สมรส", collation: "ascii_general_ci"),
                    CreatedDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    CreatedUser = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CurrentAddress = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "ที่อยู่ปัจจุบัน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CurrentDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id เขตปัจจุบัน", collation: "ascii_general_ci"),
                    CurrentProvinceId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id จังหวัดปัจจุบัน", collation: "ascii_general_ci"),
                    CurrentSubDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id แขวงปัจจุบัน", collation: "ascii_general_ci"),
                    CurrentZipCode = table.Column<string>(type: "varchar(5)", maxLength: 5, nullable: true, comment: "รหัสไปรษณีย์ปัจจุบัน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DateAppoint = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    DateRetire = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    DateStart = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    DutyTimeEffectiveDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่รอบการลงเวลามีผล"),
                    DutyTimeId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "รอบการลงเวลาเข้างาน", collation: "ascii_general_ci"),
                    EmployeeClass = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "ประเภทลูกจ้าง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EmployeeMoneyAllowance = table.Column<double>(type: "double", nullable: true, comment: "เงินช่วยเหลือค่าครองชีพชั่วคราว"),
                    EmployeeMoneyEmployee = table.Column<double>(type: "double", nullable: true, comment: "เงินสมทบประกันสังคม(ลูกจ้าง)"),
                    EmployeeMoneyEmployer = table.Column<double>(type: "double", nullable: true, comment: "เงินสมทบประกันสังคม(นายจ้าง)"),
                    EmployeeMoneyIncrease = table.Column<double>(type: "double", nullable: true, comment: "เงินเพิ่มการครองชีพชั่วคราว"),
                    EmployeeOc = table.Column<string>(type: "longtext", nullable: true, comment: "สังกัด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EmployeeType = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "ประเภทการจ้าง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EmployeeTypeIndividual = table.Column<string>(type: "longtext", nullable: true, comment: "ประเภทบุคคล")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EmployeeWage = table.Column<double>(type: "double", nullable: true, comment: "ค่าจ้าง"),
                    EntryStatus = table.Column<string>(type: "varchar(5)", maxLength: 5, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FatherCareer = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "อาชีพบิดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FatherCitizenId = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "เลขที่บัตรประชาชนบิดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FatherFirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "ชื่อบิดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FatherLastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "นามสกุลบิดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FatherLive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "มีชีวิตบิดา"),
                    FatherPrefixId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id คำนำหน้าบิดา", collation: "ascii_general_ci"),
                    FirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FirstNameOld = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อ(เดิม)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    GovAgeAbsent = table.Column<int>(type: "int", nullable: false),
                    GovAgePlus = table.Column<int>(type: "int", nullable: false),
                    GovernmentCode = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    IsLeave = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    IsProbation = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    IsTransfer = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    IsVerified = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    KeycloakId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "นามสกุล")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LastNameOld = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "นามสกุล(เดิม)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LeaveDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LeaveDateOrder = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LeaveDetail = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LeaveNumberOrder = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LeaveReason = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ModifiedDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    MotherCareer = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "อาชีพมารดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MotherCitizenId = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "เลขที่บัตรประชาชนมารดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MotherFirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "ชื่อมารดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MotherLastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "นามสกุลมารดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MotherLive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "มีชีวิตมารดา"),
                    MotherPrefixId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id คำนำหน้ามารดา", collation: "ascii_general_ci"),
                    Nationality = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "สัญชาติ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Oc = table.Column<string>(type: "longtext", nullable: true, comment: "สังกัด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OcId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id สังกัด", collation: "ascii_general_ci"),
                    OrganizationOrganization = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OrganizationOrganizationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    OrganizationShortName = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OrganizationShortNameId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Physical = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "สถานภาพทางกาย")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PosNoEmployee = table.Column<string>(type: "longtext", nullable: true, comment: "เลขที่ตำแหน่งลูกจ้าง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionExecutive = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่งทางการบริหาร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionExecutiveId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ตำแหน่งทางการบริหาร", collation: "ascii_general_ci"),
                    PositionExecutiveSide = table.Column<string>(type: "longtext", nullable: true, comment: "ด้านทางการบริหาร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionExecutiveSideId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ด้านทางการบริหาร", collation: "ascii_general_ci"),
                    PositionLine = table.Column<string>(type: "longtext", nullable: true, comment: "สายงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionLineId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id สายงาน", collation: "ascii_general_ci"),
                    PositionPathSide = table.Column<string>(type: "longtext", nullable: true, comment: "ด้าน/สาขา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionPathSideId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ด้าน/สาขา", collation: "ascii_general_ci"),
                    PrefixOldId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id คำนำหน้า(เดิม)", collation: "ascii_general_ci"),
                    ProfileType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Race = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "เชื้อชาติ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonSameDate = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RegistrationAddress = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "Id แขวงตามทะเบียนบ้าน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RegistrationDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id เขตตามทะเบียนบ้าน", collation: "ascii_general_ci"),
                    RegistrationProvinceId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id จังหวัดตามทะเบียนบ้าน", collation: "ascii_general_ci"),
                    RegistrationSame = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้านหรือไม่"),
                    RegistrationSubDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "แขวงตามทะเบียนบ้าน", collation: "ascii_general_ci"),
                    RegistrationZipCode = table.Column<string>(type: "varchar(5)", maxLength: 5, nullable: true, comment: "รหัสไปรษณีย์ตามทะเบียนบ้าน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RelationshipId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id สถานะภาพ", collation: "ascii_general_ci"),
                    ReligionId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ศาสนา", collation: "ascii_general_ci"),
                    TelephoneNumber = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "เบอร์โทร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TransferDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    VerifiedDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    VerifiedUser = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Profile", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Profile_Document_AvatarId",
                        column: x => x.AvatarId,
                        principalTable: "Document",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Profile_Genders_GenderId",
                        column: x => x.GenderId,
                        principalTable: "Genders",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Profile_LimitLeave_LimitLeaveId",
                        column: x => x.LimitLeaveId,
                        principalTable: "LimitLeave",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Profile_PositionEmployeeGroups_PositionEmployeeGroupId",
                        column: x => x.PositionEmployeeGroupId,
                        principalTable: "PositionEmployeeGroups",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Profile_PositionEmployeeLevels_PositionEmployeeLevelId",
                        column: x => x.PositionEmployeeLevelId,
                        principalTable: "PositionEmployeeLevels",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Profile_PositionEmployeeLines_PositionEmployeeLineId",
                        column: x => x.PositionEmployeeLineId,
                        principalTable: "PositionEmployeeLines",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Profile_PositionEmployeePositionSides_PositionEmployeePositi~",
                        column: x => x.PositionEmployeePositionSideId,
                        principalTable: "PositionEmployeePositionSides",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Profile_PositionEmployeePositions_PositionEmployeePositionId",
                        column: x => x.PositionEmployeePositionId,
                        principalTable: "PositionEmployeePositions",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Profile_PositionLevels_PositionLevelId",
                        column: x => x.PositionLevelId,
                        principalTable: "PositionLevels",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Profile_PositionNumbers_PosNoId",
                        column: x => x.PosNoId,
                        principalTable: "PositionNumbers",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Profile_PositionPaths_PositionId",
                        column: x => x.PositionId,
                        principalTable: "PositionPaths",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Profile_PositionTypes_PositionTypeId",
                        column: x => x.PositionTypeId,
                        principalTable: "PositionTypes",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Profile_Prefixes_PrefixId",
                        column: x => x.PrefixId,
                        principalTable: "Prefixes",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "AvailablePositionLevels",
                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"),
                    PositionLevelId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionMasterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AvailablePositionLevels", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AvailablePositionLevels_PositionLevels_PositionLevelId",
                        column: x => x.PositionLevelId,
                        principalTable: "PositionLevels",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_AvailablePositionLevels_PositionMasters_PositionMasterId",
                        column: x => x.PositionMasterId,
                        principalTable: "PositionMasters",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "OrganizationPositions",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    IsDirector = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "Is Director"),
                    PositionUserNote = table.Column<string>(type: "longtext", nullable: true, comment: "positionUserNote")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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"),
                    OrganizationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionMasterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionNumberId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrganizationPositions", x => x.Id);
                    table.ForeignKey(
                        name: "FK_OrganizationPositions_Organizations_OrganizationId",
                        column: x => x.OrganizationId,
                        principalTable: "Organizations",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_OrganizationPositions_PositionMasters_PositionMasterId",
                        column: x => x.PositionMasterId,
                        principalTable: "PositionMasters",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_OrganizationPositions_PositionNumbers_PositionNumberId",
                        column: x => x.PositionNumberId,
                        principalTable: "PositionNumbers",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PositionMasterHistoryEntity",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Position = table.Column<string>(type: "longtext", nullable: true, comment: "Position")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionPath = table.Column<string>(type: "longtext", nullable: true, comment: "PositionPath")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionType = table.Column<string>(type: "longtext", nullable: true, comment: "PositionType")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionExecutive = table.Column<string>(type: "longtext", nullable: true, comment: "PositionExecutive")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionExecutiveSide = table.Column<string>(type: "longtext", nullable: true, comment: "PositionExecutiveSide")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionPathSide = table.Column<string>(type: "longtext", nullable: true, comment: "PositionPathSide")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionLine = table.Column<string>(type: "longtext", nullable: true, comment: "PositionLine")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionStatus = table.Column<string>(type: "longtext", nullable: true, comment: "PositionStatus")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionCondition = table.Column<string>(type: "longtext", nullable: true, comment: "PositionCondition")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionLevel = table.Column<string>(type: "longtext", nullable: true, comment: "PositionLevel")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionMasterUserNote = table.Column<string>(type: "longtext", nullable: true, comment: "PositionMasterUserNote")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsDirector = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "IsDirector"),
                    Qualification = table.Column<string>(type: "longtext", nullable: true, comment: "คุณวุฒิ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    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"),
                    PositionMasterEntityId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PositionExecutiveSideObject = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionPathSideObject = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PositionMasterHistoryEntity", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PositionMasterHistoryEntity_PositionMasters_PositionMasterEn~",
                        column: x => x.PositionMasterEntityId,
                        principalTable: "PositionMasters",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "SubDistricts",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    Name = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: false, comment: "เขต/อำเภอ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ZipCode = table.Column<string>(type: "varchar(10)", maxLength: 10, nullable: false, comment: "รหัสไปรษณีย์")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
                    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"),
                    DistrictId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SubDistricts", x => x.Id);
                    table.ForeignKey(
                        name: "FK_SubDistricts_Districts_DistrictId",
                        column: x => x.DistrictId,
                        principalTable: "Districts",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileAbility",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DateEnd = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่สิ้นสุด"),
                    DateStart = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่เริ่มต้น"),
                    Detail = table.Column<string>(type: "longtext", nullable: true, comment: "รายละเอียด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Field = table.Column<string>(type: "longtext", nullable: true, comment: "ด้าน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Reference = table.Column<string>(type: "longtext", nullable: true, comment: "เอกสารอ้างอิง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "longtext", nullable: true, comment: "หมายเหตุ")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileAbility", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileAbility_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileAddressHistory",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    CurrentAddress = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "ที่อยู่ปัจจุบัน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CurrentDistrict = table.Column<string>(type: "longtext", nullable: true, comment: "เขตปัจจุบัน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CurrentDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id เขตปัจจุบัน", collation: "ascii_general_ci"),
                    CurrentProvince = table.Column<string>(type: "longtext", nullable: true, comment: "จังหวัดปัจจุบัน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CurrentProvinceId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id จังหวัดปัจจุบัน", collation: "ascii_general_ci"),
                    CurrentSubDistrict = table.Column<string>(type: "longtext", nullable: true, comment: "แขวงปัจจุบัน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CurrentSubDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id แขวงปัจจุบัน", collation: "ascii_general_ci"),
                    CurrentZipCode = table.Column<string>(type: "varchar(5)", maxLength: 5, nullable: true, comment: "รหัสไปรษณีย์ปัจจุบัน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RegistrationAddress = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "ที่อยู่ตามทะเบียนบ้าน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RegistrationDistrict = table.Column<string>(type: "longtext", nullable: true, comment: "เขตตามทะเบียนบ้าน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RegistrationDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id เขตตามทะเบียนบ้าน", collation: "ascii_general_ci"),
                    RegistrationProvince = table.Column<string>(type: "longtext", nullable: true, comment: "จังหวัดตามทะเบียนบ้าน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RegistrationProvinceId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id จังหวัดตามทะเบียนบ้าน", collation: "ascii_general_ci"),
                    RegistrationSame = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้านหรือไม่"),
                    RegistrationSubDistrict = table.Column<string>(type: "longtext", nullable: true, comment: "แขวงตามทะเบียนบ้าน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RegistrationSubDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id แขวงตามทะเบียนบ้าน", collation: "ascii_general_ci"),
                    RegistrationZipCode = table.Column<string>(type: "varchar(5)", maxLength: 5, nullable: true, comment: "รหัสไปรษณีย์ตามทะเบียนบ้าน")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileAddressHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileAddressHistory_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileAssessment",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Date = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ได้รับ"),
                    Name = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อแบบประเมิน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Point1 = table.Column<double>(type: "double", nullable: true, comment: "ผลประเมินส่วนที่1 (คะแนน)"),
                    Point1Total = table.Column<double>(type: "double", nullable: true, comment: "ส่วนที่1 (คะแนน)"),
                    Point2 = table.Column<double>(type: "double", nullable: true, comment: "ผลประเมินส่วนที่2 (คะแนน)"),
                    Point2Total = table.Column<double>(type: "double", nullable: true, comment: "ส่วนที่2 (คะแนน)"),
                    PointSum = table.Column<double>(type: "double", nullable: true, comment: "ผลประเมินรวม (คะแนน)"),
                    PointSumTotal = table.Column<double>(type: "double", nullable: true, comment: "ผลรวม (คะแนน)")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileAssessment", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileAssessment_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileAvatarHistory",
                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"),
                    AvatarFileId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileAvatarHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileAvatarHistory_Document_AvatarFileId",
                        column: x => x.AvatarFileId,
                        principalTable: "Document",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ProfileAvatarHistory_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileCertificate",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    CertificateNo = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "เลขที่ใบอนุญาต")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CertificateType = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "ชื่อใบอนุญาต")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExpireDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่หมดอายุ"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    IssueDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ออกใบอนุญาต"),
                    Issuer = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "หน่วยงานผู้ออกใบอนุญาต")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileCertificate", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileCertificate_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileChangeName",
                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"),
                    DocumentId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    FirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "ชื่อ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "นามสกุล")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Prefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้า")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PrefixId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id คำนำหน้า", collation: "ascii_general_ci"),
                    Status = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "สถานะ")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileChangeName", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileChangeName_Document_DocumentId",
                        column: x => x.DocumentId,
                        principalTable: "Document",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ProfileChangeName_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileChildren",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ChildrenCareer = table.Column<string>(type: "longtext", nullable: true, comment: "อาชีพบุตร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ChildrenFirstName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อบุตร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ChildrenLastName = table.Column<string>(type: "longtext", nullable: true, comment: "นามสกุลบุตร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ChildrenPrefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้าบุตร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ChildrenPrefixId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id คำนำหน้าบุตร", collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileChildren", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileChildren_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileCoupleHistory",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false, comment: "ไม่ใช้")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    Career = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    FirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Prefix = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileCoupleHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileCoupleHistory_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileCurrentAddressHistory",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false, comment: "ไม่ใช้")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    Address = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    DistrictId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    ProvinceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    SubDistrictId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    ZipCode = table.Column<string>(type: "varchar(5)", maxLength: 5, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileCurrentAddressHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileCurrentAddressHistory_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileDiscipline",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Date = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วัน เดือน ปี"),
                    Detail = table.Column<string>(type: "text", nullable: true, comment: "รายละเอียด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Level = table.Column<string>(type: "longtext", nullable: true, comment: "ระดับความผิด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RefCommandDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "เอกสารอ้างอิง (ลงวันที่)"),
                    RefCommandNo = table.Column<string>(type: "longtext", nullable: true, comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileDiscipline", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileDiscipline_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileDuty",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DateEnd = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "สิ้นสุด"),
                    DateStart = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "เริ่มต้น"),
                    Detail = table.Column<string>(type: "longtext", nullable: true, comment: "รายละเอียด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Reference = table.Column<string>(type: "longtext", nullable: true, comment: "เอกสารอ้างอิง")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileDuty", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileDuty_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileEducation",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Country = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true, comment: "ประเทศ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Degree = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "วุฒิการศึกษา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Duration = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true, comment: "ระยะเวลา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DurationYear = table.Column<int>(type: "int", nullable: false, comment: "ระยะเวลาหลักสูตร"),
                    EducationLevel = table.Column<string>(type: "longtext", nullable: true, comment: "ระดับศึกษา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EducationLevelId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ระดับศึกษา", collation: "ascii_general_ci"),
                    EndDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "ถึง"),
                    Field = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "สาขาวิชา/ทาง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FinishDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่สำเร็จการศึกษา"),
                    FundName = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true, comment: "ทุน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Gpa = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "เกรดเฉลี่ย")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Institute = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true, comment: "สถานศึกษา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    Other = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true, comment: "ข้อมูลการติดต่อ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionPath = table.Column<string>(type: "longtext", nullable: true, comment: "เป็นวุฒิการศึกษาในตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionPathId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id เป็นวุฒิการศึกษาในตำแหน่ง", collation: "ascii_general_ci"),
                    StartDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "ตั้งแต่")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileEducation", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileEducation_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileEmployment",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Command = table.Column<string>(type: "longtext", nullable: true, comment: "คำสั่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Date = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่จ้าง")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileEmployment", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileEmployment_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileFamilyHistory",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Couple = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "คู่สมรส"),
                    CoupleCareer = table.Column<string>(type: "longtext", nullable: true, comment: "อาชีพคู่สมรส")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CoupleFirstName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อคู่สมรส")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CoupleLastName = table.Column<string>(type: "longtext", nullable: true, comment: "นามสกุลคู่สมรส")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CoupleLastNameOld = table.Column<string>(type: "longtext", nullable: true, comment: "นามสกุลคู่สมรส(เดิม)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CouplePrefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้าคู่สมรส")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CouplePrefixId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id คำนำหน้าคู่สมรส", collation: "ascii_general_ci"),
                    FatherCareer = table.Column<string>(type: "longtext", nullable: true, comment: "อาชีพบิดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FatherFirstName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อบิดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FatherLastName = table.Column<string>(type: "longtext", nullable: true, comment: "นามสกุลบิดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FatherPrefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้าบิดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FatherPrefixId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id คำนำหน้าบิดา", collation: "ascii_general_ci"),
                    MotherCareer = table.Column<string>(type: "longtext", nullable: true, comment: "อาชีพมารดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MotherFirstName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อมารดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MotherLastName = table.Column<string>(type: "longtext", nullable: true, comment: "นามสกุลมารดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MotherPrefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้ามารดา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MotherPrefixId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id คำนำหน้ามารดา", collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileFamilyHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileFamilyHistory_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileFatherHistory",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false, comment: "ไม่ใช้")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    Career = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    FirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Prefix = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileFatherHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileFatherHistory_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileGovernmentHistory",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DateAppoint = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่สั่งบรรจุ"),
                    DateStart = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "เริ่มปฎิบัติราชการ"),
                    GovAge = table.Column<string>(type: "longtext", nullable: true, comment: "อายุราชการ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    GovAgeAbsent = table.Column<int>(type: "int", nullable: true, comment: "ขาดราชการ"),
                    GovAgePlus = table.Column<int>(type: "int", nullable: true, comment: "อายุราชการเกื้อกูล"),
                    Oc = table.Column<string>(type: "longtext", nullable: true, comment: "สังกัด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OcId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id สังกัด", collation: "ascii_general_ci"),
                    PosNo = table.Column<string>(type: "longtext", nullable: true, comment: "เลขที่ตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PosNoId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id เลขที่ตำแหน่ง", collation: "ascii_general_ci"),
                    Position = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionEmployeeGroup = table.Column<string>(type: "longtext", nullable: true, comment: "กลุ่มงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionEmployeeLevel = table.Column<string>(type: "longtext", nullable: true, comment: "ระดับชั้นงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionEmployeePosition = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionEmployeePositionSide = table.Column<string>(type: "longtext", nullable: true, comment: "ด้านของตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionExecutive = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่งทางการบริหาร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ตำแหน่ง", collation: "ascii_general_ci"),
                    PositionLevel = table.Column<string>(type: "longtext", nullable: true, comment: "ระดับตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionLine = table.Column<string>(type: "longtext", nullable: true, comment: "สายงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionType = table.Column<string>(type: "longtext", nullable: true, comment: "ประเภทตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonSameDate = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผลกรณีไม่ตรงวัน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RetireDate = table.Column<string>(type: "longtext", nullable: true, comment: "วันเกษียณอายุ")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileGovernmentHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileGovernmentHistory_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileHistory",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    BirthDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "วันเกิด"),
                    BloodGroup = table.Column<string>(type: "longtext", nullable: true, comment: "กลุ่มเลือด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    BloodGroupId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id กลุ่มเลือด", collation: "ascii_general_ci"),
                    CitizenId = table.Column<string>(type: "varchar(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EmployeeClass = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "ประเภทลูกจ้าง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EmployeeType = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "ประเภทการจ้าง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Gender = table.Column<string>(type: "longtext", nullable: true, comment: "เพศ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    GenderId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id เพศ", collation: "ascii_general_ci"),
                    LastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "นามสกุล")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Nationality = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "สัญชาติ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Prefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้า")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PrefixId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id คำนำหน้า", collation: "ascii_general_ci"),
                    Race = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "เชื้อชาติ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Relationship = table.Column<string>(type: "longtext", nullable: true, comment: "สถานะภาพ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RelationshipId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id สถานะภาพ", collation: "ascii_general_ci"),
                    Religion = table.Column<string>(type: "longtext", nullable: true, comment: "ศาสนา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReligionId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ศาสนา", collation: "ascii_general_ci"),
                    TelephoneNumber = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "เบอร์โทร")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileHistory_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileHonor",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Detail = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true, comment: "รายละเอียด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IssueDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ได้รับ"),
                    Issuer = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "หน่วยงานที่ออก")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileHonor", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileHonor_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileInsignia",
                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"),
                    InsigniaId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DateAnnounce = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ประกาศในราชกิจจาฯ"),
                    InsigniaType = table.Column<string>(type: "longtext", nullable: true, comment: "ประเภท")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Issue = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "ราชกิจจาฯ ฉบับที่")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    No = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "ลำดับที่")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Page = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "หน้า")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReceiveDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "ลงวันที่"),
                    RefCommandDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "เอกสารอ้างอิง (ลงวันที่)"),
                    RefCommandNo = table.Column<string>(type: "longtext", nullable: true, comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Section = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "ตอน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Volume = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "เล่ม")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VolumeNo = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "เล่มที่")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Year = table.Column<int>(type: "int", nullable: false, comment: "ปีที่ยื่นขอ")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileInsignia", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileInsignia_Insignias_InsigniaId",
                        column: x => x.InsigniaId,
                        principalTable: "Insignias",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ProfileInsignia_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileLeave",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    TypeLeaveId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DateEndLeave = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วัน เดือน ปี ที่สิ้นสุดลา"),
                    DateStartLeave = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วัน เดือน ปี ที่เริ่มลา"),
                    NumLeave = table.Column<double>(type: "double", nullable: true, comment: "ลาครั้งที่"),
                    Reason = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผล")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Status = table.Column<string>(type: "longtext", nullable: true, comment: "สถานะ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SumLeave = table.Column<double>(type: "double", nullable: true, comment: "ลามาแล้ว"),
                    TotalLeave = table.Column<double>(type: "double", nullable: true, comment: "รวมเป็น")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileLeave", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileLeave_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ProfileLeave_TypeLeave_TypeLeaveId",
                        column: x => x.TypeLeaveId,
                        principalTable: "TypeLeave",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileMotherHistory",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false, comment: "ไม่ใช้")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    Career = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    FirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Prefix = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileMotherHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileMotherHistory_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileNopaid",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Date = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วัน เดือน ปี"),
                    Detail = table.Column<string>(type: "longtext", nullable: true, comment: "รายละเอียด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Reference = table.Column<string>(type: "longtext", nullable: true, comment: "เอกสารอ้างอิง")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileNopaid", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileNopaid_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileOther",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Date = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่"),
                    Detail = table.Column<string>(type: "longtext", nullable: true, comment: "รายละเอียด")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileOther", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileOther_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfilePaper",
                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"),
                    DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    CategoryName = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false, comment: "ประเภทไฟล์-ไม่ใช้")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Detail = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false, comment: "ชื่อไฟล์")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfilePaper", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfilePaper_Document_DocumentId",
                        column: x => x.DocumentId,
                        principalTable: "Document",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ProfilePaper_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileRegistrationAddressHistory",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false, comment: "ไม่ใช้")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    Address = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    DistrictId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    ProvinceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    SubDistrictId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    ZipCode = table.Column<string>(type: "varchar(5)", maxLength: 5, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileRegistrationAddressHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileRegistrationAddressHistory_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileSalary",
                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"),
                    PositionLevelId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Amount = table.Column<double>(type: "double", nullable: true, comment: "เงินเดือน"),
                    CommandNo = table.Column<string>(type: "longtext", nullable: false, comment: "เลขที่คำสั่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CommandTypeName = table.Column<string>(type: "longtext", nullable: false, comment: "ประเภทคำสั่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Date = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วัน เดือน ปี รับตำแหน่ง"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    MouthSalaryAmount = table.Column<double>(type: "double", nullable: true, comment: "เงินค่าตอบแทนรายเดือน"),
                    OcId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id สังกัด", collation: "ascii_general_ci"),
                    Order = table.Column<int>(type: "int", nullable: true, comment: "ลำดับ"),
                    OrganizationShortNameId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ชื่อย่อหน่วยงาน", collation: "ascii_general_ci"),
                    PosNoEmployee = table.Column<string>(type: "longtext", nullable: true, comment: "เลขที่ตำแหน่งลูกจ้าง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PosNoId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id เลขที่ตำแหน่ง", collation: "ascii_general_ci"),
                    PositionEmployeeGroupId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id กลุ่มงาน", collation: "ascii_general_ci"),
                    PositionEmployeeLevelId = table.Column<Guid>(type: "char(36)", nullable: true, comment: " Id ระดับชั้นงาน", collation: "ascii_general_ci"),
                    PositionEmployeePositionId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ตำแหน่ง", collation: "ascii_general_ci"),
                    PositionEmployeePositionSideId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ด้านของตำแหน่ง", collation: "ascii_general_ci"),
                    PositionExecutiveId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ตำแหน่งทางการบริหาร", collation: "ascii_general_ci"),
                    PositionExecutiveSideId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ด้านทางการบริหาร", collation: "ascii_general_ci"),
                    PositionId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ตำแหน่ง", collation: "ascii_general_ci"),
                    PositionLineId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id สายงาน", collation: "ascii_general_ci"),
                    PositionPathSideId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ด้าน/สาขา", collation: "ascii_general_ci"),
                    PositionSalaryAmount = table.Column<double>(type: "double", nullable: true, comment: "เงินประจำตำแหน่ง"),
                    PositionTypeId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ประเภทตำแหน่ง", collation: "ascii_general_ci"),
                    RefCommandNo = table.Column<string>(type: "longtext", nullable: true, comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SalaryClass = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่ง (รายละเอียด)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SalaryRef = table.Column<string>(type: "longtext", nullable: true, comment: "เอกสารอ้างอิง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SalaryStatus = table.Column<string>(type: "longtext", nullable: true, comment: "ประเภทตำแหน่งกรณีพิเศษ")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileSalary", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileSalary_PositionLevels_PositionLevelId",
                        column: x => x.PositionLevelId,
                        principalTable: "PositionLevels",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ProfileSalary_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileTraining",
                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"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DateOrder = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่"),
                    Department = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Duration = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "รวมระยะเวลาในการฝึกอบรม/ดูงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EndDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันสิ้นสุดการฝึกอบรม/ดูงาน"),
                    Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "ชื่อโครงการ/หลักสูตรการฝึกอบรม")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    NumberOrder = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Place = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "สถานที่ฝึกอบรม/ดูงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    StartDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันเริ่มต้นการฝึกอบรม/ดูงาน"),
                    Topic = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "หัวข้อการฝึกอบรม/ดูงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Yearly = table.Column<int>(type: "int", maxLength: 200, nullable: true, comment: "ปีที่อบรม (พ.ศ.)")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileTraining", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileTraining_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfilePositions",
                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"),
                    OrganizationPositionId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    IsPublished = table.Column<bool>(type: "tinyint(1)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfilePositions", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfilePositions_OrganizationPositions_OrganizationPositionId",
                        column: x => x.OrganizationPositionId,
                        principalTable: "OrganizationPositions",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ProfilePositions_Profile_ProfileId",
                        column: x => x.ProfileId,
                        principalTable: "Profile",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileAbilityHistory",
                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"),
                    ProfileAbilityId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DateEnd = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่สิ้นสุด"),
                    DateStart = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่เริ่มต้น"),
                    Detail = table.Column<string>(type: "longtext", nullable: true, comment: "รายละเอียด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Field = table.Column<string>(type: "longtext", nullable: true, comment: "ด้าน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Reference = table.Column<string>(type: "longtext", nullable: true, comment: "เอกสารอ้างอิง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "longtext", nullable: true, comment: "หมายเหตุ")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileAbilityHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileAbilityHistory_ProfileAbility_ProfileAbilityId",
                        column: x => x.ProfileAbilityId,
                        principalTable: "ProfileAbility",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileAssessmentHistory",
                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"),
                    ProfileAssessmentId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Date = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ได้รับ"),
                    Name = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อแบบประเมิน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Point1 = table.Column<double>(type: "double", nullable: true, comment: "ผลประเมินส่วนที่1 (คะแนน)"),
                    Point1Total = table.Column<double>(type: "double", nullable: true, comment: "ส่วนที่1 (คะแนน)"),
                    Point2 = table.Column<double>(type: "double", nullable: true, comment: "ผลประเมินส่วนที่2 (คะแนน)"),
                    Point2Total = table.Column<double>(type: "double", nullable: true, comment: "ส่วนที่2 (คะแนน)"),
                    PointSum = table.Column<double>(type: "double", nullable: true, comment: "ผลประเมินรวม (คะแนน)"),
                    PointSumTotal = table.Column<double>(type: "double", nullable: true, comment: "ผลรวม (คะแนน)")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileAssessmentHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileAssessmentHistory_ProfileAssessment_ProfileAssessment~",
                        column: x => x.ProfileAssessmentId,
                        principalTable: "ProfileAssessment",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileCertificateHistory",
                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"),
                    ProfileCertificateId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    CertificateNo = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "เลขที่ใบอนุญาต")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CertificateType = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "ชื่อใบอนุญาต")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExpireDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่หมดอายุ"),
                    IssueDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ออกใบอนุญาต"),
                    Issuer = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "หน่วยงานผู้ออกใบอนุญาต")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileCertificateHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileCertificateHistory_ProfileCertificate_ProfileCertific~",
                        column: x => x.ProfileCertificateId,
                        principalTable: "ProfileCertificate",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileChangeNameHistory",
                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"),
                    DocumentId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ProfileChangeNameId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    FirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "ชื่อ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "นามสกุล")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Prefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้า")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PrefixId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id คำนำหน้า", collation: "ascii_general_ci"),
                    Status = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "สถานะ")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileChangeNameHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileChangeNameHistory_Document_DocumentId",
                        column: x => x.DocumentId,
                        principalTable: "Document",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ProfileChangeNameHistory_ProfileChangeName_ProfileChangeName~",
                        column: x => x.ProfileChangeNameId,
                        principalTable: "ProfileChangeName",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileDisciplineHistory",
                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"),
                    ProfileDisciplineId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Date = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วัน เดือน ปี"),
                    Detail = table.Column<string>(type: "text", nullable: true, comment: "รายละเอียด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Level = table.Column<string>(type: "longtext", nullable: true, comment: "ระดับความผิด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RefCommandDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "เอกสารอ้างอิง (ลงวันที่)"),
                    RefCommandNo = table.Column<string>(type: "longtext", nullable: true, comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileDisciplineHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileDisciplineHistory_ProfileDiscipline_ProfileDiscipline~",
                        column: x => x.ProfileDisciplineId,
                        principalTable: "ProfileDiscipline",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileDutyHistory",
                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"),
                    ProfileDutyId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DateEnd = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "สิ้นสุด"),
                    DateStart = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "เริ่มต้น"),
                    Detail = table.Column<string>(type: "longtext", nullable: true, comment: "รายละเอียด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Reference = table.Column<string>(type: "longtext", nullable: true, comment: "เอกสารอ้างอิง")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileDutyHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileDutyHistory_ProfileDuty_ProfileDutyId",
                        column: x => x.ProfileDutyId,
                        principalTable: "ProfileDuty",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileEducationHistory",
                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"),
                    ProfileEducationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Country = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true, comment: "ประเทศ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Degree = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "วุฒิการศึกษา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Duration = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true, comment: "ระยะเวลา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DurationYear = table.Column<int>(type: "int", nullable: false, comment: "ระยะเวลาหลักสูตร"),
                    EducationLevel = table.Column<string>(type: "longtext", nullable: true, comment: "ระดับศึกษา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EducationLevelId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ระดับศึกษา", collation: "ascii_general_ci"),
                    EndDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "ถึง"),
                    Field = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "สาขาวิชา/ทาง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FinishDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่สำเร็จการศึกษา"),
                    FundName = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true, comment: "ทุน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Gpa = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "เกรดเฉลี่ย")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Institute = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true, comment: "สถานศึกษา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Other = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true, comment: "ข้อมูลการติดต่อ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionPath = table.Column<string>(type: "longtext", nullable: true, comment: "เป็นวุฒิการศึกษาในตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionPathId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id เป็นวุฒิการศึกษาในตำแหน่ง", collation: "ascii_general_ci"),
                    StartDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "ตั้งแต่")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileEducationHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileEducationHistory_ProfileEducation_ProfileEducationId",
                        column: x => x.ProfileEducationId,
                        principalTable: "ProfileEducation",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileChildrenHistory",
                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"),
                    ChildrenCareer = table.Column<string>(type: "longtext", nullable: true, comment: "อาชีพบุตร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ChildrenFirstName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อบุตร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ChildrenLastName = table.Column<string>(type: "longtext", nullable: true, comment: "นามสกุลบุตร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ChildrenPrefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้าบุตร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ChildrenPrefixId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id คำนำหน้าบุตร", collation: "ascii_general_ci"),
                    ProfileChildrenId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ProfileFamilyHistoryId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileChildrenHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileChildrenHistory_ProfileChildren_ProfileChildrenId",
                        column: x => x.ProfileChildrenId,
                        principalTable: "ProfileChildren",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ProfileChildrenHistory_ProfileFamilyHistory_ProfileFamilyHis~",
                        column: x => x.ProfileFamilyHistoryId,
                        principalTable: "ProfileFamilyHistory",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileHonorHistory",
                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"),
                    ProfileHonorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Detail = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true, comment: "รายละเอียด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IssueDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ได้รับ"),
                    Issuer = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "หน่วยงานที่ออก")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileHonorHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileHonorHistory_ProfileHonor_ProfileHonorId",
                        column: x => x.ProfileHonorId,
                        principalTable: "ProfileHonor",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileInsigniaHistory",
                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"),
                    ProfileInsigniaId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DateAnnounce = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ประกาศในราชกิจจาฯ"),
                    Insignia = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อเครื่องราชฯ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    InsigniaId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    InsigniaType = table.Column<string>(type: "longtext", nullable: true, comment: "ประเภท")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Issue = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "ราชกิจจาฯ ฉบับที่")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    No = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "ลำดับที่")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Page = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "หน้า")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReceiveDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "ลงวันที่"),
                    Section = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "ตอน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Volume = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "เล่ม")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VolumeNo = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "เล่มที่")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Year = table.Column<int>(type: "int", nullable: false, comment: "ปีที่ยื่นขอ")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileInsigniaHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileInsigniaHistory_ProfileInsignia_ProfileInsigniaId",
                        column: x => x.ProfileInsigniaId,
                        principalTable: "ProfileInsignia",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileLeaveHistory",
                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"),
                    ProfileLeaveId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    TypeLeaveId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DateEndLeave = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วัน เดือน ปี ที่สิ้นสุดลา"),
                    DateStartLeave = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วัน เดือน ปี ที่เริ่มลา"),
                    NumLeave = table.Column<double>(type: "double", nullable: true, comment: "ลาครั้งที่"),
                    Reason = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผล")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Status = table.Column<string>(type: "longtext", nullable: true, comment: "สถานะ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SumLeave = table.Column<double>(type: "double", nullable: true, comment: "ลามาแล้ว"),
                    TotalLeave = table.Column<double>(type: "double", nullable: true, comment: "รวมเป็น")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileLeaveHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileLeaveHistory_ProfileLeave_ProfileLeaveId",
                        column: x => x.ProfileLeaveId,
                        principalTable: "ProfileLeave",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_ProfileLeaveHistory_TypeLeave_TypeLeaveId",
                        column: x => x.TypeLeaveId,
                        principalTable: "TypeLeave",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileNopaidHistory",
                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"),
                    ProfileNopaidId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Date = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วัน เดือน ปี"),
                    Detail = table.Column<string>(type: "longtext", nullable: true, comment: "รายละเอียด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Reference = table.Column<string>(type: "longtext", nullable: true, comment: "เอกสารอ้างอิง")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileNopaidHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileNopaidHistory_ProfileNopaid_ProfileNopaidId",
                        column: x => x.ProfileNopaidId,
                        principalTable: "ProfileNopaid",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileOtherHistory",
                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"),
                    ProfileOtherId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Date = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่"),
                    Detail = table.Column<string>(type: "longtext", nullable: true, comment: "รายละเอียด")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileOtherHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileOtherHistory_ProfileOther_ProfileOtherId",
                        column: x => x.ProfileOtherId,
                        principalTable: "ProfileOther",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileSalaryHistory",
                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"),
                    ProfileSalaryId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    Amount = table.Column<double>(type: "double", nullable: true, comment: "เงินเดือน"),
                    Date = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วัน เดือน ปี รับตำแหน่ง"),
                    MouthSalaryAmount = table.Column<double>(type: "double", nullable: true, comment: "เงินค่าตอบแทนรายเดือน"),
                    Oc = table.Column<string>(type: "longtext", nullable: true, comment: "สังกัด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OcId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id สังกัด", collation: "ascii_general_ci"),
                    OrganizationShortName = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OrganizationShortNameId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    PosNo = table.Column<string>(type: "longtext", nullable: true, comment: "เลขที่ตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PosNoEmployee = table.Column<string>(type: "longtext", nullable: true, comment: "เลขที่ตำแหน่งลูกจ้าง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PosNoId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id เลขที่ตำแหน่ง", collation: "ascii_general_ci"),
                    Position = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionEmployeeGroup = table.Column<string>(type: "longtext", nullable: true, comment: "กลุ่มงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionEmployeeGroupId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id กลุ่มงาน", collation: "ascii_general_ci"),
                    PositionEmployeeLevel = table.Column<string>(type: "longtext", nullable: true, comment: "ระดับชั้นงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionEmployeeLevelId = table.Column<Guid>(type: "char(36)", nullable: true, comment: " Id ระดับชั้นงาน", collation: "ascii_general_ci"),
                    PositionEmployeePosition = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionEmployeePositionId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ตำแหน่ง", collation: "ascii_general_ci"),
                    PositionEmployeePositionSide = table.Column<string>(type: "longtext", nullable: true, comment: "ด้านของตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionEmployeePositionSideId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ด้านของตำแหน่ง", collation: "ascii_general_ci"),
                    PositionExecutive = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่งทางการบริหาร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionExecutiveId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ด้านทางการบริหาร", collation: "ascii_general_ci"),
                    PositionExecutiveSide = table.Column<string>(type: "longtext", nullable: true, comment: "ด้านทางการบริหาร")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionExecutiveSideId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ด้านทางการบริหาร", collation: "ascii_general_ci"),
                    PositionId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ตำแหน่ง", collation: "ascii_general_ci"),
                    PositionLevel = table.Column<string>(type: "longtext", nullable: true, comment: "ระดับ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionLevelId = table.Column<Guid>(type: "char(36)", nullable: true, comment: " Id ระดับ", collation: "ascii_general_ci"),
                    PositionLine = table.Column<string>(type: "longtext", nullable: true, comment: "สายงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionLineId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id สายงาน", collation: "ascii_general_ci"),
                    PositionPathSide = table.Column<string>(type: "longtext", nullable: true, comment: "ด้าน/สาขา")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionPathSideId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ด้าน/สาขา", collation: "ascii_general_ci"),
                    PositionSalaryAmount = table.Column<double>(type: "double", nullable: true, comment: "เงินประจำตำแหน่ง"),
                    PositionType = table.Column<string>(type: "longtext", nullable: true, comment: "ประเภทตำแหน่ง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PositionTypeId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ประเภทตำแหน่ง", collation: "ascii_general_ci"),
                    SalaryClass = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่ง (รายละเอียด)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SalaryRef = table.Column<string>(type: "longtext", nullable: true, comment: "เอกสารอ้างอิง")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileSalaryHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileSalaryHistory_ProfileSalary_ProfileSalaryId",
                        column: x => x.ProfileSalaryId,
                        principalTable: "ProfileSalary",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ProfileTrainingHistory",
                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"),
                    ProfileTrainingId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DateOrder = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่"),
                    Department = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Duration = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "รวมระยะเวลาในการฝึกอบรม/ดูงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EndDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันสิ้นสุดการฝึกอบรม/ดูงาน"),
                    Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "ชื่อโครงการ/หลักสูตรการฝึกอบรม")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    NumberOrder = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Place = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "สถานที่ฝึกอบรม/ดูงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    StartDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันเริ่มต้นการฝึกอบรม/ดูงาน"),
                    Topic = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "หัวข้อการฝึกอบรม/ดูงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Yearly = table.Column<int>(type: "int", maxLength: 200, nullable: true, comment: "ปีที่อบรม (พ.ศ.)")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProfileTrainingHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProfileTrainingHistory_ProfileTraining_ProfileTrainingId",
                        column: x => x.ProfileTrainingId,
                        principalTable: "ProfileTraining",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_AvailablePositionLevels_PositionLevelId",
                table: "AvailablePositionLevels",
                column: "PositionLevelId");

            migrationBuilder.CreateIndex(
                name: "IX_AvailablePositionLevels_PositionMasterId",
                table: "AvailablePositionLevels",
                column: "PositionMasterId");

            migrationBuilder.CreateIndex(
                name: "IX_Districts_ProvinceId",
                table: "Districts",
                column: "ProvinceId");

            migrationBuilder.CreateIndex(
                name: "IX_Insignias_InsigniaTypeId",
                table: "Insignias",
                column: "InsigniaTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_LimitTypeLeave_LimitLeaveId",
                table: "LimitTypeLeave",
                column: "LimitLeaveId");

            migrationBuilder.CreateIndex(
                name: "IX_LimitTypeLeave_TypeLeaveId",
                table: "LimitTypeLeave",
                column: "TypeLeaveId");

            migrationBuilder.CreateIndex(
                name: "IX_OrganizationPositions_OrganizationId",
                table: "OrganizationPositions",
                column: "OrganizationId");

            migrationBuilder.CreateIndex(
                name: "IX_OrganizationPositions_PositionMasterId",
                table: "OrganizationPositions",
                column: "PositionMasterId");

            migrationBuilder.CreateIndex(
                name: "IX_OrganizationPositions_PositionNumberId",
                table: "OrganizationPositions",
                column: "PositionNumberId");

            migrationBuilder.CreateIndex(
                name: "IX_Organizations_OrganizationFaxId",
                table: "Organizations",
                column: "OrganizationFaxId");

            migrationBuilder.CreateIndex(
                name: "IX_Organizations_OrganizationLevelId",
                table: "Organizations",
                column: "OrganizationLevelId");

            migrationBuilder.CreateIndex(
                name: "IX_Organizations_OrganizationOrganizationId",
                table: "Organizations",
                column: "OrganizationOrganizationId");

            migrationBuilder.CreateIndex(
                name: "IX_Organizations_OrganizationShortNameId",
                table: "Organizations",
                column: "OrganizationShortNameId");

            migrationBuilder.CreateIndex(
                name: "IX_Organizations_OrganizationStatusId",
                table: "Organizations",
                column: "OrganizationStatusId");

            migrationBuilder.CreateIndex(
                name: "IX_Organizations_OrganizationTelExternalId",
                table: "Organizations",
                column: "OrganizationTelExternalId");

            migrationBuilder.CreateIndex(
                name: "IX_Organizations_OrganizationTelInternalId",
                table: "Organizations",
                column: "OrganizationTelInternalId");

            migrationBuilder.CreateIndex(
                name: "IX_Organizations_OrganizationTypeId",
                table: "Organizations",
                column: "OrganizationTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_Organizations_ParentId",
                table: "Organizations",
                column: "ParentId");

            migrationBuilder.CreateIndex(
                name: "IX_PositionMasterHistoryEntity_PositionMasterEntityId",
                table: "PositionMasterHistoryEntity",
                column: "PositionMasterEntityId");

            migrationBuilder.CreateIndex(
                name: "IX_PositionMasters_PositionExecutiveId",
                table: "PositionMasters",
                column: "PositionExecutiveId");

            migrationBuilder.CreateIndex(
                name: "IX_PositionMasters_PositionExecutiveSideId",
                table: "PositionMasters",
                column: "PositionExecutiveSideId");

            migrationBuilder.CreateIndex(
                name: "IX_PositionMasters_PositionLineId",
                table: "PositionMasters",
                column: "PositionLineId");

            migrationBuilder.CreateIndex(
                name: "IX_PositionMasters_PositionPathId",
                table: "PositionMasters",
                column: "PositionPathId");

            migrationBuilder.CreateIndex(
                name: "IX_PositionMasters_PositionPathSideId",
                table: "PositionMasters",
                column: "PositionPathSideId");

            migrationBuilder.CreateIndex(
                name: "IX_PositionMasters_PositionStatusId",
                table: "PositionMasters",
                column: "PositionStatusId");

            migrationBuilder.CreateIndex(
                name: "IX_PositionMasters_PositionTypeId",
                table: "PositionMasters",
                column: "PositionTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_PositionNumbers_OrganizationShortNameId",
                table: "PositionNumbers",
                column: "OrganizationShortNameId");

            migrationBuilder.CreateIndex(
                name: "IX_Positions_ExecutiveSideId",
                table: "Positions",
                column: "ExecutiveSideId");

            migrationBuilder.CreateIndex(
                name: "IX_Positions_PathSideId",
                table: "Positions",
                column: "PathSideId");

            migrationBuilder.CreateIndex(
                name: "IX_Positions_PositionLevelId",
                table: "Positions",
                column: "PositionLevelId");

            migrationBuilder.CreateIndex(
                name: "IX_Positions_PositionPathId",
                table: "Positions",
                column: "PositionPathId");

            migrationBuilder.CreateIndex(
                name: "IX_Positions_PositionTypeId",
                table: "Positions",
                column: "PositionTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_Profile_AvatarId",
                table: "Profile",
                column: "AvatarId");

            migrationBuilder.CreateIndex(
                name: "IX_Profile_GenderId",
                table: "Profile",
                column: "GenderId");

            migrationBuilder.CreateIndex(
                name: "IX_Profile_LimitLeaveId",
                table: "Profile",
                column: "LimitLeaveId");

            migrationBuilder.CreateIndex(
                name: "IX_Profile_PositionEmployeeGroupId",
                table: "Profile",
                column: "PositionEmployeeGroupId");

            migrationBuilder.CreateIndex(
                name: "IX_Profile_PositionEmployeeLevelId",
                table: "Profile",
                column: "PositionEmployeeLevelId");

            migrationBuilder.CreateIndex(
                name: "IX_Profile_PositionEmployeeLineId",
                table: "Profile",
                column: "PositionEmployeeLineId");

            migrationBuilder.CreateIndex(
                name: "IX_Profile_PositionEmployeePositionId",
                table: "Profile",
                column: "PositionEmployeePositionId");

            migrationBuilder.CreateIndex(
                name: "IX_Profile_PositionEmployeePositionSideId",
                table: "Profile",
                column: "PositionEmployeePositionSideId");

            migrationBuilder.CreateIndex(
                name: "IX_Profile_PositionId",
                table: "Profile",
                column: "PositionId");

            migrationBuilder.CreateIndex(
                name: "IX_Profile_PositionLevelId",
                table: "Profile",
                column: "PositionLevelId");

            migrationBuilder.CreateIndex(
                name: "IX_Profile_PositionTypeId",
                table: "Profile",
                column: "PositionTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_Profile_PosNoId",
                table: "Profile",
                column: "PosNoId");

            migrationBuilder.CreateIndex(
                name: "IX_Profile_PrefixId",
                table: "Profile",
                column: "PrefixId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileAbility_ProfileId",
                table: "ProfileAbility",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileAbilityHistory_ProfileAbilityId",
                table: "ProfileAbilityHistory",
                column: "ProfileAbilityId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileAddressHistory_ProfileId",
                table: "ProfileAddressHistory",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileAssessment_ProfileId",
                table: "ProfileAssessment",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileAssessmentHistory_ProfileAssessmentId",
                table: "ProfileAssessmentHistory",
                column: "ProfileAssessmentId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileAvatarHistory_AvatarFileId",
                table: "ProfileAvatarHistory",
                column: "AvatarFileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileAvatarHistory_ProfileId",
                table: "ProfileAvatarHistory",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileCertificate_ProfileId",
                table: "ProfileCertificate",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileCertificateHistory_ProfileCertificateId",
                table: "ProfileCertificateHistory",
                column: "ProfileCertificateId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileChangeName_DocumentId",
                table: "ProfileChangeName",
                column: "DocumentId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileChangeName_ProfileId",
                table: "ProfileChangeName",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileChangeNameHistory_DocumentId",
                table: "ProfileChangeNameHistory",
                column: "DocumentId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileChangeNameHistory_ProfileChangeNameId",
                table: "ProfileChangeNameHistory",
                column: "ProfileChangeNameId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileChildren_ProfileId",
                table: "ProfileChildren",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileChildrenHistory_ProfileChildrenId",
                table: "ProfileChildrenHistory",
                column: "ProfileChildrenId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileChildrenHistory_ProfileFamilyHistoryId",
                table: "ProfileChildrenHistory",
                column: "ProfileFamilyHistoryId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileCoupleHistory_ProfileId",
                table: "ProfileCoupleHistory",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileCurrentAddressHistory_ProfileId",
                table: "ProfileCurrentAddressHistory",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileDiscipline_ProfileId",
                table: "ProfileDiscipline",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileDisciplineHistory_ProfileDisciplineId",
                table: "ProfileDisciplineHistory",
                column: "ProfileDisciplineId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileDuty_ProfileId",
                table: "ProfileDuty",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileDutyHistory_ProfileDutyId",
                table: "ProfileDutyHistory",
                column: "ProfileDutyId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileEducation_ProfileId",
                table: "ProfileEducation",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileEducationHistory_ProfileEducationId",
                table: "ProfileEducationHistory",
                column: "ProfileEducationId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileEmployment_ProfileId",
                table: "ProfileEmployment",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileFamilyHistory_ProfileId",
                table: "ProfileFamilyHistory",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileFatherHistory_ProfileId",
                table: "ProfileFatherHistory",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileGovernmentHistory_ProfileId",
                table: "ProfileGovernmentHistory",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileHistory_ProfileId",
                table: "ProfileHistory",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileHonor_ProfileId",
                table: "ProfileHonor",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileHonorHistory_ProfileHonorId",
                table: "ProfileHonorHistory",
                column: "ProfileHonorId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileInsignia_InsigniaId",
                table: "ProfileInsignia",
                column: "InsigniaId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileInsignia_ProfileId",
                table: "ProfileInsignia",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileInsigniaHistory_ProfileInsigniaId",
                table: "ProfileInsigniaHistory",
                column: "ProfileInsigniaId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileLeave_ProfileId",
                table: "ProfileLeave",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileLeave_TypeLeaveId",
                table: "ProfileLeave",
                column: "TypeLeaveId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileLeaveHistory_ProfileLeaveId",
                table: "ProfileLeaveHistory",
                column: "ProfileLeaveId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileLeaveHistory_TypeLeaveId",
                table: "ProfileLeaveHistory",
                column: "TypeLeaveId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileMotherHistory_ProfileId",
                table: "ProfileMotherHistory",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileNopaid_ProfileId",
                table: "ProfileNopaid",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileNopaidHistory_ProfileNopaidId",
                table: "ProfileNopaidHistory",
                column: "ProfileNopaidId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileOther_ProfileId",
                table: "ProfileOther",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileOtherHistory_ProfileOtherId",
                table: "ProfileOtherHistory",
                column: "ProfileOtherId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfilePaper_DocumentId",
                table: "ProfilePaper",
                column: "DocumentId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfilePaper_ProfileId",
                table: "ProfilePaper",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfilePositions_OrganizationPositionId",
                table: "ProfilePositions",
                column: "OrganizationPositionId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfilePositions_ProfileId",
                table: "ProfilePositions",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileRegistrationAddressHistory_ProfileId",
                table: "ProfileRegistrationAddressHistory",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileSalary_PositionLevelId",
                table: "ProfileSalary",
                column: "PositionLevelId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileSalary_ProfileId",
                table: "ProfileSalary",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileSalaryHistory_ProfileSalaryId",
                table: "ProfileSalaryHistory",
                column: "ProfileSalaryId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileTraining_ProfileId",
                table: "ProfileTraining",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_ProfileTrainingHistory_ProfileTrainingId",
                table: "ProfileTrainingHistory",
                column: "ProfileTrainingId");

            migrationBuilder.CreateIndex(
                name: "IX_SubDistricts_DistrictId",
                table: "SubDistricts",
                column: "DistrictId");
        }
    }
}
