 
 CREATE INDEX INVESTARRAY_ARRAY_IDX ON INVESTIGATIONARRAY(ARRAY_ID);
 
+CREATE INDEX INVESTIGATIONSRC_INVEST_IDX ON INVESTIGATIONSOURCE(INVESTIGATION_ID);
+
+CREATE INDEX INVESTIGATIONSRC_SRC_IDX ON INVESTIGATIONSOURCE(SOURCE_ID);
+
+CREATE INDEX INVESTIGATIONSAMPLE_INVEST_IDX ON INVESTIGATIONSAMPLE(INVESTIGATION_ID);
+
+CREATE INDEX INVESTIGATIONSAMPLE_SAMPLE_IDX ON INVESTIGATIONSAMPLE(SAMPLE_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 NORMALIZATIONTYPE;
DROP TABLE IF EXISTS REPLICATETYPE;
DROP TABLE IF EXISTS QUALITYCONTROLTYPE;

  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);
