using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BMA.EHR.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class updatetableInsigniaNotesaddname : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_InsigniaNotes_Documents_ReliefDocId",
                table: "InsigniaNotes");

            migrationBuilder.DropIndex(
                name: "IX_InsigniaNotes_ReliefDocId",
                table: "InsigniaNotes");

            migrationBuilder.DropColumn(
                name: "Amount",
                table: "InsigniaNotes");

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

            migrationBuilder.DropColumn(
                name: "ReliefDocId",
                table: "InsigniaNotes");

            migrationBuilder.DropColumn(
                name: "Round",
                table: "InsigniaNotes");

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

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "Amount",
                table: "InsigniaNotes",
                type: "int",
                maxLength: 50,
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<DateTime>(
                name: "EndDate",
                table: "InsigniaNotes",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

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

            migrationBuilder.AddColumn<int>(
                name: "Round",
                table: "InsigniaNotes",
                type: "int",
                nullable: false,
                defaultValue: 0,
                comment: "ราบการยื่นขอ");

            migrationBuilder.AddColumn<DateTime>(
                name: "StartDate",
                table: "InsigniaNotes",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.CreateIndex(
                name: "IX_InsigniaNotes_ReliefDocId",
                table: "InsigniaNotes",
                column: "ReliefDocId");

            migrationBuilder.AddForeignKey(
                name: "FK_InsigniaNotes_Documents_ReliefDocId",
                table: "InsigniaNotes",
                column: "ReliefDocId",
                principalTable: "Documents",
                principalColumn: "Id");
        }
    }
}
