-- Tables

/***** Object:  Table AKUZ.T_PROCEDURE_JOURNAL_NOTE *****/
CREATE TABLE AKUZ.T_PROCEDURE_JOURNAL_NOTE
(
    "procedurejournalnoteid" uuid NOT NULL,
    "ambulancecard" uuid NOT NULL,
    "research" uuid NOT NULL,
    "resource" integer NOT NULL,
    "routedatetime" timestamp NOT NULL,
    "performerpost" integer NULL,
    "performerdatetime" timestamp NULL,
    "comment" varchar(1024) NULL
);

-- Alters

ALTER TABLE AKUZ.T_PROCEDURE_JOURNAL_NOTE ADD CONSTRAINT PK_T_PROCEDURE_JOURNAL_NOTE
PRIMARY KEY (ProcedureJournalNoteID);

ALTER TABLE AKUZ.T_PROCEDURE_JOURNAL_NOTE ADD CONSTRAINT FK_T_AMBULANCE_CARD_T_PROCEDURE_JOURNAL_NOTE_AmbulanceCard
FOREIGN KEY("ambulancecard") REFERENCES AKUZ.T_AMBULANCE_CARD (AmbulanceCardID);

ALTER TABLE AKUZ.T_PROCEDURE_JOURNAL_NOTE ADD CONSTRAINT FK_T_RESEARCH_T_PROCEDURE_JOURNAL_NOTE_Research
FOREIGN KEY("research") REFERENCES AKUZ.T_RESEARCH (MedicalServiceID);

ALTER TABLE AKUZ.T_PROCEDURE_JOURNAL_NOTE ADD CONSTRAINT FK_T_RESOURCE_T_PROCEDURE_JOURNAL_NOTE_Resource
FOREIGN KEY("resource") REFERENCES AKUZ.T_RESOURCE (ResourceID);

ALTER TABLE AKUZ.T_PROCEDURE_JOURNAL_NOTE ADD CONSTRAINT FK_T_POST_T_PROCEDURE_JOURNAL_NOTE_PerformerPost
FOREIGN KEY("performerpost") REFERENCES AKUZ.T_POST (ResourceID);

