fix import cycle encounter related

This commit is contained in:
vanilia
2025-10-21 14:58:12 +07:00
parent 3430f85902
commit 2fdfb257fe
7 changed files with 31 additions and 25 deletions
@@ -0,0 +1,8 @@
-- 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;