using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

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

            migrationBuilder.DropIndex(
                name: "IX_InsigniaNoteProfiles_OrganizationOrganizationSendId",
                table: "InsigniaNoteProfiles");

            migrationBuilder.DropColumn(
                name: "OrganizationOrganizationSendId",
                table: "InsigniaNoteProfiles");

            // migrationBuilder.AddColumn<bool>(
            //     name: "IsActive",
            //     table: "Organizations",
            //     type: "tinyint(1)",
            //     nullable: false,
            //     defaultValue: false,
            //     comment: "สถานะการใช้งาน");

            migrationBuilder.AddColumn<string>(
                name: "InvoiceNumber",
                table: "InsigniaNoteProfiles",
                type: "longtext",
                nullable: true,
                comment: "หมายเลขใบกำกับ")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "OrganizationOrganizationReceive",
                table: "InsigniaNoteProfiles",
                type: "longtext",
                nullable: true,
                comment: "สังกัด ณ วันที่ได้รับพระราชทานเครื่องราชฯ")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "OrganizationOrganizationSend",
                table: "InsigniaNoteProfiles",
                type: "longtext",
                nullable: true,
                comment: "สังกัด ณ วันที่ขอพระราชทานเครื่องราชฯ")
                .Annotation("MySql:CharSet", "utf8mb4");
        }

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

            migrationBuilder.DropColumn(
                name: "InvoiceNumber",
                table: "InsigniaNoteProfiles");

            migrationBuilder.DropColumn(
                name: "OrganizationOrganizationReceive",
                table: "InsigniaNoteProfiles");

            migrationBuilder.DropColumn(
                name: "OrganizationOrganizationSend",
                table: "InsigniaNoteProfiles");

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

            migrationBuilder.CreateIndex(
                name: "IX_InsigniaNoteProfiles_OrganizationOrganizationSendId",
                table: "InsigniaNoteProfiles",
                column: "OrganizationOrganizationSendId");

            migrationBuilder.AddForeignKey(
                name: "FK_InsigniaNoteProfiles_OrganizationOrganizations_OrganizationO~",
                table: "InsigniaNoteProfiles",
                column: "OrganizationOrganizationSendId",
                principalTable: "OrganizationOrganizations",
                principalColumn: "Id");
        }
    }
}
