using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BMA.EHR.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class updatetableinsigniaperiodaddreason : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "DocumentId",
                table: "InsigniaRequests",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AlterColumn<string>(
                name: "Reason",
                table: "InsigniaRequestProfiles",
                type: "longtext",
                nullable: true,
                comment: "เหตุผลการได้รับเครื่องราชฯ",
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true,
                oldComment: "เหตุผลไม่ยื่นขอ")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "ReasonReject",
                table: "InsigniaRequestProfiles",
                type: "longtext",
                nullable: true,
                comment: "เหตุผลไม่ยื่นขอ")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_InsigniaRequests_DocumentId",
                table: "InsigniaRequests",
                column: "DocumentId");

            migrationBuilder.AddForeignKey(
                name: "FK_InsigniaRequests_Documents_DocumentId",
                table: "InsigniaRequests",
                column: "DocumentId",
                principalTable: "Documents",
                principalColumn: "Id");
        }

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

            migrationBuilder.DropIndex(
                name: "IX_InsigniaRequests_DocumentId",
                table: "InsigniaRequests");

            migrationBuilder.DropColumn(
                name: "DocumentId",
                table: "InsigniaRequests");

            migrationBuilder.DropColumn(
                name: "ReasonReject",
                table: "InsigniaRequestProfiles");

            migrationBuilder.AlterColumn<string>(
                name: "Reason",
                table: "InsigniaRequestProfiles",
                type: "longtext",
                nullable: true,
                comment: "เหตุผลไม่ยื่นขอ",
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true,
                oldComment: "เหตุผลการได้รับเครื่องราชฯ")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");
        }
    }
}
