-- Rename a column from "DischargeMethod_Code" to "Discharge_Method_Code"
ALTER TABLE "public"."Encounter" RENAME COLUMN "DischargeMethod_Code" TO "Discharge_Method_Code";
-- Modify "Encounter" table
ALTER TABLE "public"."Encounter" ADD COLUMN "Discharge_Date" timestamptz NULL;
-- Modify "DeathCause" table
ALTER TABLE "public"."DeathCause" DROP CONSTRAINT "fk_DeathCause_Encounter", ADD CONSTRAINT "fk_Encounter_DeathCause" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "InternalReference" table
ALTER TABLE "public"."InternalReference" DROP CONSTRAINT "fk_InternalReference_Encounter", ADD CONSTRAINT "fk_Encounter_InternalReferences" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION;
