using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

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

            migrationBuilder.DropForeignKey(
                name: "FK_PlacementProfiles_OrganizationPositions_OrganizationPosition~",
                table: "PlacementProfiles");

            migrationBuilder.DropForeignKey(
                name: "FK_PlacementProfiles_PositionLines_PositionLineId",
                table: "PlacementProfiles");

            migrationBuilder.DropForeignKey(
                name: "FK_PlacementProfiles_PositionNumbers_PositionNumberId",
                table: "PlacementProfiles");

            migrationBuilder.DropForeignKey(
                name: "FK_PlacementProfiles_PositionPathSides_PositionPathSideId",
                table: "PlacementProfiles");

            migrationBuilder.DropForeignKey(
                name: "FK_PlacementProfiles_PositionPaths_PositionCandidateId",
                table: "PlacementProfiles");

            migrationBuilder.DropForeignKey(
                name: "FK_PlacementProfiles_PositionPaths_PositionPathId",
                table: "PlacementProfiles");

            migrationBuilder.DropIndex(
                name: "IX_PlacementProfiles_OrganizationPositionId",
                table: "PlacementProfiles");

            migrationBuilder.DropIndex(
                name: "IX_PlacementProfiles_PositionCandidateId",
                table: "PlacementProfiles");

            migrationBuilder.DropIndex(
                name: "IX_PlacementProfiles_PositionLineId",
                table: "PlacementProfiles");

            migrationBuilder.DropIndex(
                name: "IX_PlacementProfiles_PositionNumberId",
                table: "PlacementProfiles");

            migrationBuilder.DropIndex(
                name: "IX_PlacementProfiles_PositionPathId",
                table: "PlacementProfiles");

            migrationBuilder.DropIndex(
                name: "IX_PlacementProfiles_PositionPathSideId",
                table: "PlacementProfiles");

            migrationBuilder.DropIndex(
                name: "IX_PlacementEducations_EducationLevelId",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "OrganizationPositionId",
                table: "PlacementProfiles");

            migrationBuilder.DropColumn(
                name: "PositionCandidateId",
                table: "PlacementProfiles");

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

            migrationBuilder.DropColumn(
                name: "PositionNumberId",
                table: "PlacementProfiles");

            migrationBuilder.DropColumn(
                name: "PositionPathId",
                table: "PlacementProfiles");

            migrationBuilder.DropColumn(
                name: "PositionPathSideId",
                table: "PlacementProfiles");

            migrationBuilder.AlterColumn<Guid>(
                name: "EducationLevelId",
                table: "PlacementEducations",
                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: "EducationLevelName",
                table: "PlacementEducations",
                type: "longtext",
                nullable: true,
                comment: "วุฒิที่ได้รับ")
                .Annotation("MySql:CharSet", "utf8mb4");
        }

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

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

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

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

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

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

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

            migrationBuilder.AlterColumn<Guid>(
                name: "EducationLevelId",
                table: "PlacementEducations",
                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.CreateIndex(
                name: "IX_PlacementProfiles_OrganizationPositionId",
                table: "PlacementProfiles",
                column: "OrganizationPositionId");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementProfiles_PositionCandidateId",
                table: "PlacementProfiles",
                column: "PositionCandidateId");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementProfiles_PositionLineId",
                table: "PlacementProfiles",
                column: "PositionLineId");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementProfiles_PositionNumberId",
                table: "PlacementProfiles",
                column: "PositionNumberId");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementProfiles_PositionPathId",
                table: "PlacementProfiles",
                column: "PositionPathId");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementProfiles_PositionPathSideId",
                table: "PlacementProfiles",
                column: "PositionPathSideId");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementEducations_EducationLevelId",
                table: "PlacementEducations",
                column: "EducationLevelId");

            migrationBuilder.AddForeignKey(
                name: "FK_PlacementEducations_EducationLevels_EducationLevelId",
                table: "PlacementEducations",
                column: "EducationLevelId",
                principalTable: "EducationLevels",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_PlacementProfiles_OrganizationPositions_OrganizationPosition~",
                table: "PlacementProfiles",
                column: "OrganizationPositionId",
                principalTable: "OrganizationPositions",
                principalColumn: "Id");

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

            migrationBuilder.AddForeignKey(
                name: "FK_PlacementProfiles_PositionNumbers_PositionNumberId",
                table: "PlacementProfiles",
                column: "PositionNumberId",
                principalTable: "PositionNumbers",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_PlacementProfiles_PositionPathSides_PositionPathSideId",
                table: "PlacementProfiles",
                column: "PositionPathSideId",
                principalTable: "PositionPathSides",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_PlacementProfiles_PositionPaths_PositionCandidateId",
                table: "PlacementProfiles",
                column: "PositionCandidateId",
                principalTable: "PositionPaths",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_PlacementProfiles_PositionPaths_PositionPathId",
                table: "PlacementProfiles",
                column: "PositionPathId",
                principalTable: "PositionPaths",
                principalColumn: "Id");
        }
    }
}
