using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

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

            migrationBuilder.DropForeignKey(
                name: "FK_PlacementTransfers_PositionLevels_PositionLevelOldId",
                table: "PlacementTransfers");

            migrationBuilder.DropForeignKey(
                name: "FK_PlacementTransfers_PositionNumbers_PositionNumberOldId",
                table: "PlacementTransfers");

            migrationBuilder.DropForeignKey(
                name: "FK_PlacementTransfers_PositionTypes_PositionTypeOldId",
                table: "PlacementTransfers");

            migrationBuilder.DropForeignKey(
                name: "FK_RetirementResigns_OrganizationOrganizations_OrganizationOrga~",
                table: "RetirementResigns");

            migrationBuilder.DropForeignKey(
                name: "FK_RetirementResigns_PositionExecutives_PositionExecutiveId",
                table: "RetirementResigns");

            migrationBuilder.DropForeignKey(
                name: "FK_RetirementResigns_PositionLevels_PositionLevelId",
                table: "RetirementResigns");

            migrationBuilder.DropForeignKey(
                name: "FK_RetirementResigns_PositionLines_PositionLineId",
                table: "RetirementResigns");

            migrationBuilder.DropForeignKey(
                name: "FK_RetirementResigns_PositionTypes_PositionTypeId",
                table: "RetirementResigns");

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

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

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

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

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

            migrationBuilder.DropIndex(
                name: "IX_PlacementTransfers_OrganizationPositionOldId",
                table: "PlacementTransfers");

            migrationBuilder.DropIndex(
                name: "IX_PlacementTransfers_PositionLevelOldId",
                table: "PlacementTransfers");

            migrationBuilder.DropIndex(
                name: "IX_PlacementTransfers_PositionNumberOldId",
                table: "PlacementTransfers");

            migrationBuilder.DropIndex(
                name: "IX_PlacementTransfers_PositionTypeOldId",
                table: "PlacementTransfers");

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

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

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

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

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

            migrationBuilder.DropColumn(
                name: "OrganizationPositionOldId",
                table: "PlacementTransfers");

            migrationBuilder.DropColumn(
                name: "PositionLevelOldId",
                table: "PlacementTransfers");

            migrationBuilder.DropColumn(
                name: "PositionNumberOldId",
                table: "PlacementTransfers");

            migrationBuilder.DropColumn(
                name: "PositionTypeOldId",
                table: "PlacementTransfers");

            migrationBuilder.AddColumn<double>(
                name: "AmountOld",
                table: "RetirementResigns",
                type: "double",
                nullable: true,
                comment: "ข้อมูลหน่วยงานเดิม เงินเดือน");

            migrationBuilder.AddColumn<string>(
                name: "OrganizationPositionOld",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "สังกัด")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "PositionLevelOld",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ข้อมูลหน่วยงานเดิม ระดับ")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "PositionNumberOld",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ข้อมูลหน่วยงานเดิม เลขที่")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "PositionTypeOld",
                table: "RetirementResigns",
                type: "longtext",
                nullable: true,
                comment: "ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "OrganizationPositionOld",
                table: "PlacementTransfers",
                type: "longtext",
                nullable: true,
                comment: "สังกัด")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "PositionLevelOld",
                table: "PlacementTransfers",
                type: "longtext",
                nullable: true,
                comment: "ข้อมูลหน่วยงานเดิม ระดับ")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "PositionNumberOld",
                table: "PlacementTransfers",
                type: "longtext",
                nullable: true,
                comment: "ข้อมูลหน่วยงานเดิม เลขที่")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "PositionTypeOld",
                table: "PlacementTransfers",
                type: "longtext",
                nullable: true,
                comment: "ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<double>(
                name: "AmountOld",
                table: "PlacementReceives",
                type: "double",
                nullable: true,
                comment: "ข้อมูลหน่วยงานเดิม เงินเดือน");

            migrationBuilder.AddColumn<string>(
                name: "EducationOld",
                table: "PlacementReceives",
                type: "longtext",
                nullable: true,
                comment: "วุฒิ/สาขาเดิม")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "OrganizationPositionOld",
                table: "PlacementReceives",
                type: "longtext",
                nullable: true,
                comment: "สังกัดเดิม")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "PositionLevelOld",
                table: "PlacementReceives",
                type: "longtext",
                nullable: true,
                comment: "ข้อมูลหน่วยงานเดิม ระดับ")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "PositionNumberOld",
                table: "PlacementReceives",
                type: "longtext",
                nullable: true,
                comment: "ข้อมูลหน่วยงานเดิม เลขที่")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "PositionTypeOld",
                table: "PlacementReceives",
                type: "longtext",
                nullable: true,
                comment: "ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "Reason",
                table: "PlacementReceives",
                type: "longtext",
                nullable: true,
                comment: "เหตุผลที่รับโอนราชการ")
                .Annotation("MySql:CharSet", "utf8mb4");
        }

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

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

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

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

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

            migrationBuilder.DropColumn(
                name: "OrganizationPositionOld",
                table: "PlacementTransfers");

            migrationBuilder.DropColumn(
                name: "PositionLevelOld",
                table: "PlacementTransfers");

            migrationBuilder.DropColumn(
                name: "PositionNumberOld",
                table: "PlacementTransfers");

            migrationBuilder.DropColumn(
                name: "PositionTypeOld",
                table: "PlacementTransfers");

            migrationBuilder.DropColumn(
                name: "AmountOld",
                table: "PlacementReceives");

            migrationBuilder.DropColumn(
                name: "EducationOld",
                table: "PlacementReceives");

            migrationBuilder.DropColumn(
                name: "OrganizationPositionOld",
                table: "PlacementReceives");

            migrationBuilder.DropColumn(
                name: "PositionLevelOld",
                table: "PlacementReceives");

            migrationBuilder.DropColumn(
                name: "PositionNumberOld",
                table: "PlacementReceives");

            migrationBuilder.DropColumn(
                name: "PositionTypeOld",
                table: "PlacementReceives");

            migrationBuilder.DropColumn(
                name: "Reason",
                table: "PlacementReceives");

            migrationBuilder.AddColumn<Guid>(
                name: "OrganizationOrganizationId",
                table: "RetirementResigns",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "PositionExecutiveId",
                table: "RetirementResigns",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "PositionLevelId",
                table: "RetirementResigns",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "PositionLineId",
                table: "RetirementResigns",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "PositionTypeId",
                table: "RetirementResigns",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "OrganizationPositionOldId",
                table: "PlacementTransfers",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "PositionLevelOldId",
                table: "PlacementTransfers",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "PositionNumberOldId",
                table: "PlacementTransfers",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "PositionTypeOldId",
                table: "PlacementTransfers",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.CreateIndex(
                name: "IX_RetirementResigns_OrganizationOrganizationId",
                table: "RetirementResigns",
                column: "OrganizationOrganizationId");

            migrationBuilder.CreateIndex(
                name: "IX_RetirementResigns_PositionExecutiveId",
                table: "RetirementResigns",
                column: "PositionExecutiveId");

            migrationBuilder.CreateIndex(
                name: "IX_RetirementResigns_PositionLevelId",
                table: "RetirementResigns",
                column: "PositionLevelId");

            migrationBuilder.CreateIndex(
                name: "IX_RetirementResigns_PositionLineId",
                table: "RetirementResigns",
                column: "PositionLineId");

            migrationBuilder.CreateIndex(
                name: "IX_RetirementResigns_PositionTypeId",
                table: "RetirementResigns",
                column: "PositionTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementTransfers_OrganizationPositionOldId",
                table: "PlacementTransfers",
                column: "OrganizationPositionOldId");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementTransfers_PositionLevelOldId",
                table: "PlacementTransfers",
                column: "PositionLevelOldId");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementTransfers_PositionNumberOldId",
                table: "PlacementTransfers",
                column: "PositionNumberOldId");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementTransfers_PositionTypeOldId",
                table: "PlacementTransfers",
                column: "PositionTypeOldId");

            migrationBuilder.AddForeignKey(
                name: "FK_PlacementTransfers_OrganizationPositions_OrganizationPositio~",
                table: "PlacementTransfers",
                column: "OrganizationPositionOldId",
                principalTable: "OrganizationPositions",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_PlacementTransfers_PositionLevels_PositionLevelOldId",
                table: "PlacementTransfers",
                column: "PositionLevelOldId",
                principalTable: "PositionLevels",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_PlacementTransfers_PositionNumbers_PositionNumberOldId",
                table: "PlacementTransfers",
                column: "PositionNumberOldId",
                principalTable: "PositionNumbers",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_PlacementTransfers_PositionTypes_PositionTypeOldId",
                table: "PlacementTransfers",
                column: "PositionTypeOldId",
                principalTable: "PositionTypes",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_RetirementResigns_OrganizationOrganizations_OrganizationOrga~",
                table: "RetirementResigns",
                column: "OrganizationOrganizationId",
                principalTable: "OrganizationOrganizations",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_RetirementResigns_PositionExecutives_PositionExecutiveId",
                table: "RetirementResigns",
                column: "PositionExecutiveId",
                principalTable: "PositionExecutives",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_RetirementResigns_PositionLevels_PositionLevelId",
                table: "RetirementResigns",
                column: "PositionLevelId",
                principalTable: "PositionLevels",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_RetirementResigns_PositionLines_PositionLineId",
                table: "RetirementResigns",
                column: "PositionLineId",
                principalTable: "PositionLines",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_RetirementResigns_PositionTypes_PositionTypeId",
                table: "RetirementResigns",
                column: "PositionTypeId",
                principalTable: "PositionTypes",
                principalColumn: "Id");
        }
    }
}
