using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BMA.EHR.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class updatetableplacementreceiveaddprofileid : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "ProfileId",
                table: "RetirementOthers",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "ProfileId",
                table: "PlacementRelocations",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "ProfileId",
                table: "PlacementReceives",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "ProfileId",
                table: "PlacementAppointments",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.CreateIndex(
                name: "IX_RetirementOthers_ProfileId",
                table: "RetirementOthers",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementRelocations_ProfileId",
                table: "PlacementRelocations",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementReceives_ProfileId",
                table: "PlacementReceives",
                column: "ProfileId");

            migrationBuilder.CreateIndex(
                name: "IX_PlacementAppointments_ProfileId",
                table: "PlacementAppointments",
                column: "ProfileId");

            migrationBuilder.AddForeignKey(
                name: "FK_PlacementAppointments_Profiles_ProfileId",
                table: "PlacementAppointments",
                column: "ProfileId",
                principalTable: "Profiles",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_PlacementReceives_Profiles_ProfileId",
                table: "PlacementReceives",
                column: "ProfileId",
                principalTable: "Profiles",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_PlacementRelocations_Profiles_ProfileId",
                table: "PlacementRelocations",
                column: "ProfileId",
                principalTable: "Profiles",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_RetirementOthers_Profiles_ProfileId",
                table: "RetirementOthers",
                column: "ProfileId",
                principalTable: "Profiles",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

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

            migrationBuilder.DropForeignKey(
                name: "FK_PlacementReceives_Profiles_ProfileId",
                table: "PlacementReceives");

            migrationBuilder.DropForeignKey(
                name: "FK_PlacementRelocations_Profiles_ProfileId",
                table: "PlacementRelocations");

            migrationBuilder.DropForeignKey(
                name: "FK_RetirementOthers_Profiles_ProfileId",
                table: "RetirementOthers");

            migrationBuilder.DropIndex(
                name: "IX_RetirementOthers_ProfileId",
                table: "RetirementOthers");

            migrationBuilder.DropIndex(
                name: "IX_PlacementRelocations_ProfileId",
                table: "PlacementRelocations");

            migrationBuilder.DropIndex(
                name: "IX_PlacementReceives_ProfileId",
                table: "PlacementReceives");

            migrationBuilder.DropIndex(
                name: "IX_PlacementAppointments_ProfileId",
                table: "PlacementAppointments");

            migrationBuilder.DropColumn(
                name: "ProfileId",
                table: "RetirementOthers");

            migrationBuilder.DropColumn(
                name: "ProfileId",
                table: "PlacementRelocations");

            migrationBuilder.DropColumn(
                name: "ProfileId",
                table: "PlacementReceives");

            migrationBuilder.DropColumn(
                name: "ProfileId",
                table: "PlacementAppointments");
        }
    }
}
