using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
    /// <inheritdoc />
    public partial class AddDirectorCommentandIsCompletetoLeaveRequest : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<string>(
                name: "LeaveStatus",
                table: "LeaveRequests",
                type: "longtext",
                nullable: false,
                comment: "สถานะของคำร้อง",
                oldClrType: typeof(string),
                oldType: "longtext")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<string>(
                name: "LeaveComment",
                table: "LeaveRequests",
                type: "longtext",
                nullable: true,
                comment: "ความเห็นของผู้บังคับบัญชา",
                oldClrType: typeof(string),
                oldType: "longtext")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<bool>(
                name: "IsComplete",
                table: "LeaveRequests",
                type: "tinyint(1)",
                nullable: false,
                defaultValue: false,
                comment: "สถานะการทำงานของคำขอว่าสิ้นสุดการทำงานหรือไม่");

            migrationBuilder.AddColumn<string>(
                name: "LeaveDirectorComment",
                table: "LeaveRequests",
                type: "longtext",
                nullable: true,
                comment: "ความเห็นของผู้อำนวยการสำนัก")
                .Annotation("MySql:CharSet", "utf8mb4");
        }

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

            migrationBuilder.DropColumn(
                name: "LeaveDirectorComment",
                table: "LeaveRequests");

            migrationBuilder.AlterColumn<string>(
                name: "LeaveStatus",
                table: "LeaveRequests",
                type: "longtext",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldComment: "สถานะของคำร้อง")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.UpdateData(
                table: "LeaveRequests",
                keyColumn: "LeaveComment",
                keyValue: null,
                column: "LeaveComment",
                value: "");

            migrationBuilder.AlterColumn<string>(
                name: "LeaveComment",
                table: "LeaveRequests",
                type: "longtext",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true,
                oldComment: "ความเห็นของผู้บังคับบัญชา")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");
        }
    }
}
