using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BMA.EHR.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class updatetableprofileaddemployeetemp : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "PositionEmployeeGroup",
                table: "Profiles");

            migrationBuilder.DropColumn(
                name: "PositionEmployeeLevel",
                table: "Profiles");

            migrationBuilder.DropColumn(
                name: "PositionEmployeePosition",
                table: "Profiles");

            migrationBuilder.DropColumn(
                name: "PositionEmployeePositionSide",
                table: "Profiles");

            migrationBuilder.AlterColumn<Guid>(
                name: "PositionEmployeePositionSideId",
                table: "Profiles",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci",
                oldClrType: typeof(Guid),
                oldType: "char(36)",
                oldNullable: true,
                oldComment: "Id ด้านของตำแหน่ง")
                .OldAnnotation("Relational:Collation", "ascii_general_ci");

            migrationBuilder.AlterColumn<Guid>(
                name: "PositionEmployeePositionId",
                table: "Profiles",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci",
                oldClrType: typeof(Guid),
                oldType: "char(36)",
                oldNullable: true,
                oldComment: "Id ตำแหน่ง")
                .OldAnnotation("Relational:Collation", "ascii_general_ci");

            migrationBuilder.AlterColumn<Guid>(
                name: "PositionEmployeeLevelId",
                table: "Profiles",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci",
                oldClrType: typeof(Guid),
                oldType: "char(36)",
                oldNullable: true,
                oldComment: " Id ระดับชั้นงาน")
                .OldAnnotation("Relational:Collation", "ascii_general_ci");

            migrationBuilder.AlterColumn<Guid>(
                name: "PositionEmployeeGroupId",
                table: "Profiles",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci",
                oldClrType: typeof(Guid),
                oldType: "char(36)",
                oldNullable: true,
                oldComment: "Id กลุ่มงาน")
                .OldAnnotation("Relational:Collation", "ascii_general_ci");

            migrationBuilder.AddColumn<double>(
                name: "EmployeeMoneyAllowance",
                table: "Profiles",
                type: "double",
                nullable: true,
                comment: "เงินช่วยเหลือค่าครองชีพชั่วคราว");

            migrationBuilder.AddColumn<double>(
                name: "EmployeeMoneyEmployee",
                table: "Profiles",
                type: "double",
                nullable: true,
                comment: "เงินสมทบประกันสังคม(ลูกจ้าง)");

            migrationBuilder.AddColumn<double>(
                name: "EmployeeMoneyEmployer",
                table: "Profiles",
                type: "double",
                nullable: true,
                comment: "เงินสมทบประกันสังคม(นายจ้าง)");

            migrationBuilder.AddColumn<double>(
                name: "EmployeeMoneyIncrease",
                table: "Profiles",
                type: "double",
                nullable: true,
                comment: "เงินเพิ่มการครองชีพชั่วคราว");

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

            migrationBuilder.AddColumn<string>(
                name: "EmployeeTypeIndividual",
                table: "Profiles",
                type: "longtext",
                nullable: true,
                comment: "ประเภทบุคคล")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "EmployeeWage",
                table: "Profiles",
                type: "longtext",
                nullable: true,
                comment: "ค่าจ้าง")
                .Annotation("MySql:CharSet", "utf8mb4");

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

            migrationBuilder.CreateIndex(
                name: "IX_Profiles_PositionEmployeeGroupId",
                table: "Profiles",
                column: "PositionEmployeeGroupId");

            migrationBuilder.CreateIndex(
                name: "IX_Profiles_PositionEmployeeLevelId",
                table: "Profiles",
                column: "PositionEmployeeLevelId");

            migrationBuilder.CreateIndex(
                name: "IX_Profiles_PositionEmployeeLineId",
                table: "Profiles",
                column: "PositionEmployeeLineId");

            migrationBuilder.CreateIndex(
                name: "IX_Profiles_PositionEmployeePositionId",
                table: "Profiles",
                column: "PositionEmployeePositionId");

            migrationBuilder.CreateIndex(
                name: "IX_Profiles_PositionEmployeePositionSideId",
                table: "Profiles",
                column: "PositionEmployeePositionSideId");

            migrationBuilder.AddForeignKey(
                name: "FK_Profiles_PositionEmployeeGroups_PositionEmployeeGroupId",
                table: "Profiles",
                column: "PositionEmployeeGroupId",
                principalTable: "PositionEmployeeGroups",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_Profiles_PositionEmployeeLevels_PositionEmployeeLevelId",
                table: "Profiles",
                column: "PositionEmployeeLevelId",
                principalTable: "PositionEmployeeLevels",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_Profiles_PositionEmployeeLines_PositionEmployeeLineId",
                table: "Profiles",
                column: "PositionEmployeeLineId",
                principalTable: "PositionEmployeeLines",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_Profiles_PositionEmployeePositionSides_PositionEmployeePosit~",
                table: "Profiles",
                column: "PositionEmployeePositionSideId",
                principalTable: "PositionEmployeePositionSides",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_Profiles_PositionEmployeePositions_PositionEmployeePositionId",
                table: "Profiles",
                column: "PositionEmployeePositionId",
                principalTable: "PositionEmployeePositions",
                principalColumn: "Id");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Profiles_PositionEmployeeGroups_PositionEmployeeGroupId",
                table: "Profiles");

            migrationBuilder.DropForeignKey(
                name: "FK_Profiles_PositionEmployeeLevels_PositionEmployeeLevelId",
                table: "Profiles");

            migrationBuilder.DropForeignKey(
                name: "FK_Profiles_PositionEmployeeLines_PositionEmployeeLineId",
                table: "Profiles");

            migrationBuilder.DropForeignKey(
                name: "FK_Profiles_PositionEmployeePositionSides_PositionEmployeePosit~",
                table: "Profiles");

            migrationBuilder.DropForeignKey(
                name: "FK_Profiles_PositionEmployeePositions_PositionEmployeePositionId",
                table: "Profiles");

            migrationBuilder.DropIndex(
                name: "IX_Profiles_PositionEmployeeGroupId",
                table: "Profiles");

            migrationBuilder.DropIndex(
                name: "IX_Profiles_PositionEmployeeLevelId",
                table: "Profiles");

            migrationBuilder.DropIndex(
                name: "IX_Profiles_PositionEmployeeLineId",
                table: "Profiles");

            migrationBuilder.DropIndex(
                name: "IX_Profiles_PositionEmployeePositionId",
                table: "Profiles");

            migrationBuilder.DropIndex(
                name: "IX_Profiles_PositionEmployeePositionSideId",
                table: "Profiles");

            migrationBuilder.DropColumn(
                name: "EmployeeMoneyAllowance",
                table: "Profiles");

            migrationBuilder.DropColumn(
                name: "EmployeeMoneyEmployee",
                table: "Profiles");

            migrationBuilder.DropColumn(
                name: "EmployeeMoneyEmployer",
                table: "Profiles");

            migrationBuilder.DropColumn(
                name: "EmployeeMoneyIncrease",
                table: "Profiles");

            migrationBuilder.DropColumn(
                name: "EmployeeOc",
                table: "Profiles");

            migrationBuilder.DropColumn(
                name: "EmployeeTypeIndividual",
                table: "Profiles");

            migrationBuilder.DropColumn(
                name: "EmployeeWage",
                table: "Profiles");

            migrationBuilder.DropColumn(
                name: "PositionEmployeeLineId",
                table: "Profiles");

            migrationBuilder.AlterColumn<Guid>(
                name: "PositionEmployeePositionSideId",
                table: "Profiles",
                type: "char(36)",
                nullable: true,
                comment: "Id ด้านของตำแหน่ง",
                collation: "ascii_general_ci",
                oldClrType: typeof(Guid),
                oldType: "char(36)",
                oldNullable: true)
                .OldAnnotation("Relational:Collation", "ascii_general_ci");

            migrationBuilder.AlterColumn<Guid>(
                name: "PositionEmployeePositionId",
                table: "Profiles",
                type: "char(36)",
                nullable: true,
                comment: "Id ตำแหน่ง",
                collation: "ascii_general_ci",
                oldClrType: typeof(Guid),
                oldType: "char(36)",
                oldNullable: true)
                .OldAnnotation("Relational:Collation", "ascii_general_ci");

            migrationBuilder.AlterColumn<Guid>(
                name: "PositionEmployeeLevelId",
                table: "Profiles",
                type: "char(36)",
                nullable: true,
                comment: " Id ระดับชั้นงาน",
                collation: "ascii_general_ci",
                oldClrType: typeof(Guid),
                oldType: "char(36)",
                oldNullable: true)
                .OldAnnotation("Relational:Collation", "ascii_general_ci");

            migrationBuilder.AlterColumn<Guid>(
                name: "PositionEmployeeGroupId",
                table: "Profiles",
                type: "char(36)",
                nullable: true,
                comment: "Id กลุ่มงาน",
                collation: "ascii_general_ci",
                oldClrType: typeof(Guid),
                oldType: "char(36)",
                oldNullable: true)
                .OldAnnotation("Relational:Collation", "ascii_general_ci");

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

            migrationBuilder.AddColumn<string>(
                name: "PositionEmployeeLevel",
                table: "Profiles",
                type: "longtext",
                nullable: true,
                comment: "ระดับชั้นงาน")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "PositionEmployeePosition",
                table: "Profiles",
                type: "longtext",
                nullable: true,
                comment: "ตำแหน่ง")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "PositionEmployeePositionSide",
                table: "Profiles",
                type: "longtext",
                nullable: true,
                comment: "ด้านของตำแหน่ง")
                .Annotation("MySql:CharSet", "utf8mb4");
        }
    }
}
