update migration

This commit is contained in:
ari
2025-12-04 14:01:57 +07:00
parent 320ce99b0e
commit 9d3a872eba
5 changed files with 27 additions and 17 deletions
@@ -1,5 +1,5 @@
-- Create "ActionReport" table
CREATE TABLE "public"."ActionReport" (
-- Create "ProcedureReport" table
CREATE TABLE "public"."ProcedureReport" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
@@ -7,13 +7,23 @@ CREATE TABLE "public"."ActionReport" (
"Encounter_Id" bigint NULL,
"Date" character varying(20) NOT NULL,
"Doctor_Code" character varying(10) NULL,
"Operator_Employe_Id" bigint NULL,
"Assistant_Employe_Id" bigint NULL,
"Instrumentor_Employe_Id" bigint NULL,
"Operator_Name" character varying(120) NULL,
"Assistant_Name" character varying(120) NULL,
"Instrumentor_Name" character varying(120) NULL,
"Diagnose" character varying(1024) NULL,
"Procedures" character varying(10240) NULL,
"Nurse_Code" character varying(10) NULL,
"Value" text NULL,
"Nurse_Name" character varying(120) NULL,
"ProcedureValue" text NULL,
"ExecutionValue" text NULL,
"Type" character varying(10) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "fk_ActionReport_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
CONSTRAINT "fk_ProcedureReport_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- PROPER
-- "Operator_Employe_Id" bigint NULL,
-- "Assistant_Employe_Id" bigint NULL,
-- "Instrumentor_Employe_Id" bigint NULL,
-- "Diagnose" character varying(1024) NULL,
-- "Procedures" character varying(10240) NULL,
-- "Nurse_Code" character varying(10) NULL,
@@ -1,2 +1,2 @@
-- Modify "ActionReport" table
ALTER TABLE "public"."ActionReport" DROP COLUMN "Date", DROP COLUMN "Procedures";
-- Modify "ProcedureReport" table
ALTER TABLE "public"."ProcedureReport" DROP COLUMN "Date", DROP COLUMN "Procedures";
@@ -1,2 +1,2 @@
-- Modify "ActionReport" table
ALTER TABLE "public"."ActionReport" ADD COLUMN "Date" timestamptz NOT NULL;
-- Modify "ProcedureReport" table
ALTER TABLE "public"."ProcedureReport" ADD COLUMN "Date" timestamptz NOT NULL;
@@ -1,2 +1,2 @@
-- Modify "ActionReport" table
ALTER TABLE "public"."ActionReport" ADD CONSTRAINT "fk_ActionReport_Instrumentor_Employe" FOREIGN KEY ("Instrumentor_Employe_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_ActionReport_Nurse" FOREIGN KEY ("Nurse_Code") REFERENCES "public"."Nurse" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_ActionReport_Operator_Employe" FOREIGN KEY ("Operator_Employe_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "ProcedureReport" table
ALTER TABLE "public"."ProcedureReport" ADD CONSTRAINT "fk_ProcedureReport_Instrumentor_Employe" FOREIGN KEY ("Instrumentor_Employe_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_ProcedureReport_Nurse" FOREIGN KEY ("Nurse_Code") REFERENCES "public"."Nurse" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_ProcedureReport_Operator_Employe" FOREIGN KEY ("Operator_Employe_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION;
@@ -1,2 +1,2 @@
-- Modify "ActionReport" table
ALTER TABLE "public"."ActionReport" ADD CONSTRAINT "fk_ActionReport_Doctor" FOREIGN KEY ("Doctor_Code") REFERENCES "public"."Doctor" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "ProcedureReport" table
ALTER TABLE "public"."ProcedureReport" ADD CONSTRAINT "fk_ProcedureReport_Doctor" FOREIGN KEY ("Doctor_Code") REFERENCES "public"."Doctor" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;