DROP TABLE IF EXISTS blueprint_layer;
DROP TABLE IF EXISTS blueprint;
DROP TABLE IF EXISTS timeslot;
+DROP TABLE IF EXISTS blueprint_instance_timeslot;
DROP TABLE IF EXISTS lab;
create table lab (
CONSTRAINT id_pk PRIMARY KEY (id),
CONSTRAINT lab_id_fk FOREIGN KEY (lab_id)
REFERENCES lab (id) MATCH SIMPLE
- ON UPDATE NO ACTION ON DELETE NO ACTION,
- unique (start_date_time, lab_id)
+ ON UPDATE NO ACTION ON DELETE NO ACTION
);
CREATE TABLE blueprint
unique (blueprint_instance_id, blueprint_layer_id)
);
+CREATE TABLE blueprint_instance_timeslot
+(
+ blueprint_instance_id bigint not NULL,
+ timeslot_id bigint not NULL,
+ CONSTRAINT blueprint_instance_id_fk3 FOREIGN KEY (blueprint_instance_id)
+ REFERENCES blueprint_instance (id) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION,
+ CONSTRAINT timeslot_id_fk FOREIGN KEY (timeslot_id)
+ REFERENCES timeslot (id) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION,
+ unique (blueprint_instance_id, timeslot_id)
+);
+
CREATE TABLE submission
(
id bigint not NULL AUTO_INCREMENT,
status text not NULL,
timeslot_id bigint not NULL,
CONSTRAINT id_pk PRIMARY KEY (id),
- CONSTRAINT timeslot_id_fk FOREIGN KEY (timeslot_id)
+ CONSTRAINT timeslot_id_fk2 FOREIGN KEY (timeslot_id)
REFERENCES timeslot (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
submission_id bigint,
date_of_storage text,
CONSTRAINT id_pk PRIMARY KEY (id),
- CONSTRAINT lab_id_fk3 FOREIGN KEY (lab_id)
+ CONSTRAINT lab_id_fk2 FOREIGN KEY (lab_id)
REFERENCES lab (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT submission_id_fk FOREIGN KEY (submission_id)