using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
    /// <inheritdoc />
    public partial class updatetablecandidateaddanouncementDate : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<int>(
                name: "Round",
                table: "PeriodExams",
                type: "int",
                nullable: true,
                comment: "รอบการสอบ",
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true,
                oldComment: "รอบการสอบ")
                .Annotation("Relational:ColumnOrder", 9)
                .OldAnnotation("Relational:ColumnOrder", 8);

            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "PeriodExams",
                type: "varchar(150)",
                maxLength: 150,
                nullable: false,
                comment: "ชื่อการสอบ",
                oldClrType: typeof(string),
                oldType: "varchar(150)",
                oldMaxLength: 150,
                oldComment: "ชื่อการสอบ")
                .Annotation("MySql:CharSet", "utf8mb4")
                .Annotation("Relational:ColumnOrder", 8)
                .OldAnnotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("Relational:ColumnOrder", 7);

            migrationBuilder.AlterColumn<DateTime>(
                name: "AnnouncementStartDate",
                table: "PeriodExams",
                type: "datetime(6)",
                nullable: false,
                comment: "วันเริ่มประกาศ",
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)",
                oldComment: "วันเริ่มประกาศ")
                .Annotation("Relational:ColumnOrder", 6)
                .OldAnnotation("Relational:ColumnOrder", 5);

            migrationBuilder.AlterColumn<DateTime>(
                name: "AnnouncementEndDate",
                table: "PeriodExams",
                type: "datetime(6)",
                nullable: false,
                comment: "วันสิ้นสุดประกาศ",
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)",
                oldComment: "วันสิ้นสุดประกาศ")
                .Annotation("Relational:ColumnOrder", 7)
                .OldAnnotation("Relational:ColumnOrder", 6);

            migrationBuilder.AddColumn<DateTime>(
                name: "AnnouncementDate",
                table: "PeriodExams",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                comment: "วันประกาศผลสอบ")
                .Annotation("Relational:ColumnOrder", 5);
        }

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

            migrationBuilder.AlterColumn<int>(
                name: "Round",
                table: "PeriodExams",
                type: "int",
                nullable: true,
                comment: "รอบการสอบ",
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true,
                oldComment: "รอบการสอบ")
                .Annotation("Relational:ColumnOrder", 8)
                .OldAnnotation("Relational:ColumnOrder", 9);

            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "PeriodExams",
                type: "varchar(150)",
                maxLength: 150,
                nullable: false,
                comment: "ชื่อการสอบ",
                oldClrType: typeof(string),
                oldType: "varchar(150)",
                oldMaxLength: 150,
                oldComment: "ชื่อการสอบ")
                .Annotation("MySql:CharSet", "utf8mb4")
                .Annotation("Relational:ColumnOrder", 7)
                .OldAnnotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("Relational:ColumnOrder", 8);

            migrationBuilder.AlterColumn<DateTime>(
                name: "AnnouncementStartDate",
                table: "PeriodExams",
                type: "datetime(6)",
                nullable: false,
                comment: "วันเริ่มประกาศ",
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)",
                oldComment: "วันเริ่มประกาศ")
                .Annotation("Relational:ColumnOrder", 5)
                .OldAnnotation("Relational:ColumnOrder", 6);

            migrationBuilder.AlterColumn<DateTime>(
                name: "AnnouncementEndDate",
                table: "PeriodExams",
                type: "datetime(6)",
                nullable: false,
                comment: "วันสิ้นสุดประกาศ",
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)",
                oldComment: "วันสิ้นสุดประกาศ")
                .Annotation("Relational:ColumnOrder", 6)
                .OldAnnotation("Relational:ColumnOrder", 7);
        }
    }
}
