DROP TABLE AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH;

DROP TABLE AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION;

CREATE TABLE AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION
(
    "fpumpstcsimultaneousserviceznocontraindicationid" uuid NOT NULL,
    "contraindication" uuid NULL,
    "registrationdate" timestamp NULL,
    "simultaneousservice" uuid NOT NULL
);

ALTER TABLE AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION ADD CONSTRAINT PK_T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION
PRIMARY KEY (FpumpStcSimultaneousServiceZnoContraindicationID);

ALTER TABLE AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION ADD CONSTRAINT FK_T_N001_ONKPROT_T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_70A8303C
FOREIGN KEY("contraindication") REFERENCES AKUZ.T_N001_OnkPrOt (N001ID);

ALTER TABLE AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION ADD CONSTRAINT FK_T_FPUMP_STC_SIMULTANEOUS_SERVICE_T_FPUMP_STC_SIMULT_CAAEA56F
FOREIGN KEY("simultaneousservice") REFERENCES AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE (FpumpStcSimultaneousServiceID);

CREATE TABLE AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH
(
    "fpumpstcsimultaneousserviceznoresearchid" uuid NOT NULL,
    "materialcollectdate" timestamp NULL,
    "isresultreceived" boolean NOT NULL,
    "marktypecode" integer NULL,
    "mark" uuid NULL,
    "result" uuid NULL,
    "simultaneousservice" uuid NOT NULL
);

ALTER TABLE AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH ADD CONSTRAINT PK_T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH
PRIMARY KEY (FpumpStcSimultaneousServiceZnoResearchID);

ALTER TABLE AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH ADD CONSTRAINT FK_T_N007_ONKMRF_T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO__A6DB4755
FOREIGN KEY("mark") REFERENCES AKUZ.T_N007_OnkMrf (N007ID);

ALTER TABLE AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH ADD CONSTRAINT FK_T_N008_ONKMRFRT_T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZN_024E0FDC
FOREIGN KEY("result") REFERENCES AKUZ.T_N008_OnkMrfRt (N008ID);

ALTER TABLE AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH ADD CONSTRAINT FK_T_FPUMP_STC_SIMULTANEOUS_SERVICE_T_FPUMP_STC_SIMULT_C608552D
FOREIGN KEY("simultaneousservice") REFERENCES AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE (FpumpStcSimultaneousServiceID);

