using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BMA.EHR.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class updatetableRetirementaddfiledoc : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "DocumentId",
                table: "RetirementPeriods",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

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

            migrationBuilder.CreateIndex(
                name: "IX_RetirementPeriods_DocumentId",
                table: "RetirementPeriods",
                column: "DocumentId");

            migrationBuilder.CreateIndex(
                name: "IX_RetirementPeriodHistorys_DocumentId",
                table: "RetirementPeriodHistorys",
                column: "DocumentId");

            migrationBuilder.AddForeignKey(
                name: "FK_RetirementPeriodHistorys_Documents_DocumentId",
                table: "RetirementPeriodHistorys",
                column: "DocumentId",
                principalTable: "Documents",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_RetirementPeriods_Documents_DocumentId",
                table: "RetirementPeriods",
                column: "DocumentId",
                principalTable: "Documents",
                principalColumn: "Id");
        }

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

            migrationBuilder.DropForeignKey(
                name: "FK_RetirementPeriods_Documents_DocumentId",
                table: "RetirementPeriods");

            migrationBuilder.DropIndex(
                name: "IX_RetirementPeriods_DocumentId",
                table: "RetirementPeriods");

            migrationBuilder.DropIndex(
                name: "IX_RetirementPeriodHistorys_DocumentId",
                table: "RetirementPeriodHistorys");

            migrationBuilder.DropColumn(
                name: "DocumentId",
                table: "RetirementPeriods");

            migrationBuilder.DropColumn(
                name: "DocumentId",
                table: "RetirementPeriodHistorys");
        }
    }
}
