using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace VigilCareClinicalAPI.Migrations
{
    /// <inheritdoc />
    public partial class AddReconciliationAlerts : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateIndex(
                name: "IX_reconciliation_alerts_encounter_id",
                table: "reconciliation_alerts",
                column: "encounter_id");

            migrationBuilder.CreateIndex(
                name: "IX_reconciliation_alerts_patient_id",
                table: "reconciliation_alerts",
                column: "patient_id");

            migrationBuilder.AddForeignKey(
                name: "FK_reconciliation_alerts_encounters_encounter_id",
                table: "reconciliation_alerts",
                column: "encounter_id",
                principalTable: "encounters",
                principalColumn: "id",
                onDelete: ReferentialAction.SetNull);

            migrationBuilder.AddForeignKey(
                name: "FK_reconciliation_alerts_patients_patient_id",
                table: "reconciliation_alerts",
                column: "patient_id",
                principalTable: "patients",
                principalColumn: "id",
                onDelete: ReferentialAction.SetNull);
        }

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

            migrationBuilder.DropForeignKey(
                name: "FK_reconciliation_alerts_patients_patient_id",
                table: "reconciliation_alerts");

            migrationBuilder.DropIndex(
                name: "IX_reconciliation_alerts_encounter_id",
                table: "reconciliation_alerts");

            migrationBuilder.DropIndex(
                name: "IX_reconciliation_alerts_patient_id",
                table: "reconciliation_alerts");
        }
    }
}
