   ADD FOREIGN KEY(ARRAY_ID)
   REFERENCES ARRAY(ID);
 
+ALTER TABLE INVESTIGATIONSOURCE
+  ADD FOREIGN KEY(INVESTIGATION_ID)
+  REFERENCES INVESTIGATION(ID);
+
+ALTER TABLE INVESTIGATIONSOURCE
+  ADD FOREIGN KEY(SOURCE_ID)
+  REFERENCES BIOMATERIAL(ID);
+
+ALTER TABLE INVESTIGATIONSAMPLE
+  ADD FOREIGN KEY(INVESTIGATION_ID)
+  REFERENCES INVESTIGATION(ID);
+
+ALTER TABLE INVESTIGATIONSAMPLE
+  ADD FOREIGN KEY(SAMPLE_ID)
+  REFERENCES BIOMATERIAL(ID);
+
 ALTER TABLE NORMALIZATIONTYPE
   ADD FOREIGN KEY(INVESTIGATION_ID)
   REFERENCES INVESTIGATION(ID);


CREATE INDEX INVESTARRAY_ARRAY_IDX ON INVESTIGATIONARRAY(ARRAY_ID);

CREATE INDEX NORMTYPE_INVEST_IDX ON NORMALIZATIONTYPE(INVESTIGATION_ID);

CREATE INDEX NORMTYPE_TERM_IDX ON NORMALIZATIONTYPE(TERM_ID);

DROP TABLE IF EXISTS EXPERIMENT;
DROP TABLE IF EXISTS INVESTIGATIONARRAYDESIGN;
DROP TABLE IF EXISTS INVESTIGATIONARRAY;
DROP TABLE IF EXISTS INVESTIGATIONSOURCE;
DROP TABLE IF EXISTS INVESTIGATIONSAMPLE;
DROP TABLE IF EXISTS NORMALIZATIONTYPE;
DROP TABLE IF EXISTS REPLICATETYPE;
DROP TABLE IF EXISTS QUALITYCONTROLTYPE;
