using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

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

            migrationBuilder.DropColumn(
                name: "DurationStart",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "Major",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "Name",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "Scores",
                table: "PlacementEducations");

            migrationBuilder.AddColumn<string>(
                name: "Country",
                table: "PlacementEducations",
                type: "varchar(1000)",
                maxLength: 1000,
                nullable: true,
                comment: "ประเทศ")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "Degree",
                table: "PlacementEducations",
                type: "varchar(200)",
                maxLength: 200,
                nullable: true,
                comment: "วุฒิการศึกษา")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "Duration",
                table: "PlacementEducations",
                type: "varchar(1000)",
                maxLength: 1000,
                nullable: true,
                comment: "ระยะเวลา")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<int>(
                name: "DurationYear",
                table: "PlacementEducations",
                type: "int",
                nullable: false,
                defaultValue: 0,
                comment: "ระยะเวลาหลักสูตร");

            migrationBuilder.AddColumn<DateTime>(
                name: "EndDate",
                table: "PlacementEducations",
                type: "datetime(6)",
                nullable: true,
                comment: "ถึง");

            migrationBuilder.AddColumn<string>(
                name: "Field",
                table: "PlacementEducations",
                type: "varchar(200)",
                maxLength: 200,
                nullable: true,
                comment: "สาขาวิชา/ทาง")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "FinishDate",
                table: "PlacementEducations",
                type: "datetime(6)",
                nullable: true,
                comment: "วันที่สำเร็จการศึกษา");

            migrationBuilder.AddColumn<string>(
                name: "FundName",
                table: "PlacementEducations",
                type: "varchar(1000)",
                maxLength: 1000,
                nullable: true,
                comment: "ทุน")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "Gpa",
                table: "PlacementEducations",
                type: "varchar(20)",
                maxLength: 20,
                nullable: true,
                comment: "เกรดเฉลี่ย")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "Institute",
                table: "PlacementEducations",
                type: "varchar(1000)",
                maxLength: 1000,
                nullable: true,
                comment: "สถานศึกษา")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<bool>(
                name: "IsDate",
                table: "PlacementEducations",
                type: "tinyint(1)",
                nullable: true,
                comment: "ประเภทช่วงเวลาการศึกษา");

            migrationBuilder.AddColumn<bool>(
                name: "IsEducation",
                table: "PlacementEducations",
                type: "tinyint(1)",
                nullable: true,
                comment: "เป็นวุฒิศึกษาในตำแหน่ง");

            migrationBuilder.AddColumn<string>(
                name: "Other",
                table: "PlacementEducations",
                type: "varchar(1000)",
                maxLength: 1000,
                nullable: true,
                comment: "ข้อมูลการติดต่อ")
                .Annotation("MySql:CharSet", "utf8mb4");

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

            migrationBuilder.AddColumn<DateTime>(
                name: "StartDate",
                table: "PlacementEducations",
                type: "datetime(6)",
                nullable: true,
                comment: "ตั้งแต่");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementEducations_PositionPathId",
                table: "PlacementEducations",
                column: "PositionPathId");

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

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

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

            migrationBuilder.DropColumn(
                name: "Country",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "Degree",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "Duration",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "DurationYear",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "EndDate",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "Field",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "FinishDate",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "FundName",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "Gpa",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "Institute",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "IsDate",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "IsEducation",
                table: "PlacementEducations");

            migrationBuilder.DropColumn(
                name: "Other",
                table: "PlacementEducations");

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

            migrationBuilder.DropColumn(
                name: "StartDate",
                table: "PlacementEducations");

            migrationBuilder.AddColumn<DateTime>(
                name: "DurationEnd",
                table: "PlacementEducations",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                comment: "ระยะเวลาสิ้นสุด");

            migrationBuilder.AddColumn<DateTime>(
                name: "DurationStart",
                table: "PlacementEducations",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                comment: "ระยะเวลาเริ่ม");

            migrationBuilder.AddColumn<string>(
                name: "Major",
                table: "PlacementEducations",
                type: "longtext",
                nullable: false,
                comment: "สาขาวิชา/วิชาเอก")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "Name",
                table: "PlacementEducations",
                type: "longtext",
                nullable: false,
                comment: "ชื่อสถานศึกษา")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<float>(
                name: "Scores",
                table: "PlacementEducations",
                type: "float",
                maxLength: 10,
                nullable: false,
                defaultValue: 0f,
                comment: "คะแนนเฉลี่ยตลอดหลักสูตร");
        }
    }
}
