using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BMA.EHR.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class updateTablepositionpathaddorder : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "PositionTypes",
                type: "varchar(100)",
                maxLength: 100,
                nullable: false,
                comment: "ชื่อประเภทตำแหน่ง",
                oldClrType: typeof(string),
                oldType: "varchar(100)",
                oldMaxLength: 100,
                oldComment: "ชื่อประเภทตำแหน่ง")
                .Annotation("MySql:CharSet", "utf8mb4")
                .Annotation("Relational:ColumnOrder", 2)
                .OldAnnotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("Relational:ColumnOrder", 1);

            migrationBuilder.AlterColumn<bool>(
                name: "IsActive",
                table: "PositionTypes",
                type: "tinyint(1)",
                nullable: false,
                comment: "สถานะการใช้งาน",
                oldClrType: typeof(bool),
                oldType: "tinyint(1)",
                oldComment: "สถานะการใช้งาน")
                .Annotation("Relational:ColumnOrder", 3)
                .OldAnnotation("Relational:ColumnOrder", 2);

            migrationBuilder.AddColumn<int>(
                name: "Order",
                table: "PositionTypes",
                type: "int",
                nullable: true,
                comment: "ลำดับ")
                .Annotation("Relational:ColumnOrder", 1);

            migrationBuilder.AlterColumn<string>(
                name: "ShortName",
                table: "PositionLevels",
                type: "varchar(100)",
                maxLength: 100,
                nullable: false,
                comment: "ชื่อย่อระดับตำแหน่ง",
                oldClrType: typeof(string),
                oldType: "varchar(100)",
                oldMaxLength: 100,
                oldComment: "ชื่อย่อระดับตำแหน่ง")
                .Annotation("MySql:CharSet", "utf8mb4")
                .Annotation("Relational:ColumnOrder", 3)
                .OldAnnotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("Relational:ColumnOrder", 2);

            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "PositionLevels",
                type: "varchar(100)",
                maxLength: 100,
                nullable: false,
                comment: "ชื่อระดับตำแหน่ง",
                oldClrType: typeof(string),
                oldType: "varchar(100)",
                oldMaxLength: 100,
                oldComment: "ชื่อระดับตำแหน่ง")
                .Annotation("MySql:CharSet", "utf8mb4")
                .Annotation("Relational:ColumnOrder", 2)
                .OldAnnotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("Relational:ColumnOrder", 1);

            migrationBuilder.AlterColumn<int>(
                name: "Level",
                table: "PositionLevels",
                type: "int",
                nullable: false,
                comment: "ลำดับชั้นของระดับตำแหน่ง",
                oldClrType: typeof(int),
                oldType: "int",
                oldComment: "ลำดับชั้นของระดับตำแหน่ง")
                .Annotation("Relational:ColumnOrder", 4)
                .OldAnnotation("Relational:ColumnOrder", 3);

            migrationBuilder.AlterColumn<bool>(
                name: "IsActive",
                table: "PositionLevels",
                type: "tinyint(1)",
                nullable: false,
                comment: "สถานะการใช้งาน",
                oldClrType: typeof(bool),
                oldType: "tinyint(1)",
                oldComment: "สถานะการใช้งาน")
                .Annotation("Relational:ColumnOrder", 5)
                .OldAnnotation("Relational:ColumnOrder", 4);

            migrationBuilder.AddColumn<int>(
                name: "Order",
                table: "PositionLevels",
                type: "int",
                nullable: true,
                comment: "ลำดับ")
                .Annotation("Relational:ColumnOrder", 1);

            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "PositionEmployeeLevels",
                type: "varchar(100)",
                maxLength: 100,
                nullable: false,
                comment: "ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ",
                oldClrType: typeof(string),
                oldType: "varchar(100)",
                oldMaxLength: 100,
                oldComment: "ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")
                .Annotation("MySql:CharSet", "utf8mb4")
                .Annotation("Relational:ColumnOrder", 2)
                .OldAnnotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("Relational:ColumnOrder", 1);

            migrationBuilder.AlterColumn<bool>(
                name: "IsActive",
                table: "PositionEmployeeLevels",
                type: "tinyint(1)",
                nullable: false,
                comment: "สถานะการใช้งาน",
                oldClrType: typeof(bool),
                oldType: "tinyint(1)",
                oldComment: "สถานะการใช้งาน")
                .Annotation("Relational:ColumnOrder", 3)
                .OldAnnotation("Relational:ColumnOrder", 2);

            migrationBuilder.AddColumn<int>(
                name: "Order",
                table: "PositionEmployeeLevels",
                type: "int",
                nullable: true,
                comment: "ลำดับ")
                .Annotation("Relational:ColumnOrder", 1);
        }

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

            migrationBuilder.DropColumn(
                name: "Order",
                table: "PositionLevels");

            migrationBuilder.DropColumn(
                name: "Order",
                table: "PositionEmployeeLevels");

            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "PositionTypes",
                type: "varchar(100)",
                maxLength: 100,
                nullable: false,
                comment: "ชื่อประเภทตำแหน่ง",
                oldClrType: typeof(string),
                oldType: "varchar(100)",
                oldMaxLength: 100,
                oldComment: "ชื่อประเภทตำแหน่ง")
                .Annotation("MySql:CharSet", "utf8mb4")
                .Annotation("Relational:ColumnOrder", 1)
                .OldAnnotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("Relational:ColumnOrder", 2);

            migrationBuilder.AlterColumn<bool>(
                name: "IsActive",
                table: "PositionTypes",
                type: "tinyint(1)",
                nullable: false,
                comment: "สถานะการใช้งาน",
                oldClrType: typeof(bool),
                oldType: "tinyint(1)",
                oldComment: "สถานะการใช้งาน")
                .Annotation("Relational:ColumnOrder", 2)
                .OldAnnotation("Relational:ColumnOrder", 3);

            migrationBuilder.AlterColumn<string>(
                name: "ShortName",
                table: "PositionLevels",
                type: "varchar(100)",
                maxLength: 100,
                nullable: false,
                comment: "ชื่อย่อระดับตำแหน่ง",
                oldClrType: typeof(string),
                oldType: "varchar(100)",
                oldMaxLength: 100,
                oldComment: "ชื่อย่อระดับตำแหน่ง")
                .Annotation("MySql:CharSet", "utf8mb4")
                .Annotation("Relational:ColumnOrder", 2)
                .OldAnnotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("Relational:ColumnOrder", 3);

            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "PositionLevels",
                type: "varchar(100)",
                maxLength: 100,
                nullable: false,
                comment: "ชื่อระดับตำแหน่ง",
                oldClrType: typeof(string),
                oldType: "varchar(100)",
                oldMaxLength: 100,
                oldComment: "ชื่อระดับตำแหน่ง")
                .Annotation("MySql:CharSet", "utf8mb4")
                .Annotation("Relational:ColumnOrder", 1)
                .OldAnnotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("Relational:ColumnOrder", 2);

            migrationBuilder.AlterColumn<int>(
                name: "Level",
                table: "PositionLevels",
                type: "int",
                nullable: false,
                comment: "ลำดับชั้นของระดับตำแหน่ง",
                oldClrType: typeof(int),
                oldType: "int",
                oldComment: "ลำดับชั้นของระดับตำแหน่ง")
                .Annotation("Relational:ColumnOrder", 3)
                .OldAnnotation("Relational:ColumnOrder", 4);

            migrationBuilder.AlterColumn<bool>(
                name: "IsActive",
                table: "PositionLevels",
                type: "tinyint(1)",
                nullable: false,
                comment: "สถานะการใช้งาน",
                oldClrType: typeof(bool),
                oldType: "tinyint(1)",
                oldComment: "สถานะการใช้งาน")
                .Annotation("Relational:ColumnOrder", 4)
                .OldAnnotation("Relational:ColumnOrder", 5);

            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "PositionEmployeeLevels",
                type: "varchar(100)",
                maxLength: 100,
                nullable: false,
                comment: "ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ",
                oldClrType: typeof(string),
                oldType: "varchar(100)",
                oldMaxLength: 100,
                oldComment: "ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")
                .Annotation("MySql:CharSet", "utf8mb4")
                .Annotation("Relational:ColumnOrder", 1)
                .OldAnnotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("Relational:ColumnOrder", 2);

            migrationBuilder.AlterColumn<bool>(
                name: "IsActive",
                table: "PositionEmployeeLevels",
                type: "tinyint(1)",
                nullable: false,
                comment: "สถานะการใช้งาน",
                oldClrType: typeof(bool),
                oldType: "tinyint(1)",
                oldComment: "สถานะการใช้งาน")
                .Annotation("Relational:ColumnOrder", 2)
                .OldAnnotation("Relational:ColumnOrder", 3);
        }
    }
}
