X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=ui%2Fdb-scripts%2Fakraino_blueprint_validation_db.sql;h=31f9ad551eb4c91fa6041fe94440ad77ac0d3f88;hb=3ff5d7028b19a649f6b80c476ff45ced1fdd67dc;hp=6b94c2c9c2f48907236f012a62893814bdc27cbb;hpb=770d403ce7ae30a6c5404887c0e0fcb0ca5c6f48;p=validation.git diff --git a/ui/db-scripts/akraino_blueprint_validation_db.sql b/ui/db-scripts/akraino_blueprint_validation_db.sql index 6b94c2c..31f9ad5 100644 --- a/ui/db-scripts/akraino_blueprint_validation_db.sql +++ b/ui/db-scripts/akraino_blueprint_validation_db.sql @@ -18,18 +18,21 @@ SET FOREIGN_KEY_CHECKS=1; use akraino; -DROP TABLE IF EXISTS blueprint_instance_for_validation; -DROP TABLE IF EXISTS blueprint; -DROP TABLE IF EXISTS silo; -DROP TABLE IF EXISTS timeslot; -DROP TABLE IF EXISTS lab; DROP TABLE IF EXISTS w_robot_test_result; DROP TABLE IF EXISTS validation_test_result; DROP TABLE IF EXISTS submission; +DROP TABLE IF EXISTS blueprint_instance_blueprint_layer; +DROP TABLE IF EXISTS blueprint_instance; +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 ( id bigint not NULL AUTO_INCREMENT, lab text not NULL unique, + silo text not NULL unique, CONSTRAINT id_pk PRIMARY KEY (id) ); @@ -44,35 +47,56 @@ create table timeslot ( ON UPDATE NO ACTION ON DELETE NO ACTION ); -create table silo ( +CREATE TABLE blueprint +( id bigint not NULL AUTO_INCREMENT, - silo text not NULL, - lab_id bigint not NULL unique, - CONSTRAINT id_pk PRIMARY KEY (id), - CONSTRAINT lab_id_fk2 FOREIGN KEY (lab_id) - REFERENCES lab (id) MATCH SIMPLE - ON UPDATE NO ACTION ON DELETE NO ACTION + blueprint_name varchar(20) not NULL unique, + CONSTRAINT id_pk PRIMARY KEY (id) ); -CREATE TABLE blueprint +CREATE TABLE blueprint_layer ( id bigint not NULL AUTO_INCREMENT, - blueprint_name varchar(20) not NULL unique, + layer text not NULL unique, CONSTRAINT id_pk PRIMARY KEY (id) ); -CREATE TABLE blueprint_instance_for_validation +CREATE TABLE blueprint_instance ( id bigint not NULL AUTO_INCREMENT, blueprint_id bigint not NULL, version text not NULL, - layer text not NULL, - layer_description text not NULL, CONSTRAINT id_pk PRIMARY KEY (id), CONSTRAINT blueprint_id_fk FOREIGN KEY (blueprint_id) REFERENCES blueprint (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, - unique (version, layer, blueprint_id) + unique (version, blueprint_id) +); + +CREATE TABLE blueprint_instance_blueprint_layer +( + blueprint_instance_id bigint not NULL, + blueprint_layer_id bigint not NULL, + CONSTRAINT blueprint_instance_id_fk2 FOREIGN KEY (blueprint_instance_id) + REFERENCES blueprint_instance (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT blueprint_layer_id_fk FOREIGN KEY (blueprint_layer_id) + REFERENCES blueprint_layer (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + 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 @@ -81,7 +105,7 @@ CREATE TABLE submission 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 ); @@ -89,22 +113,24 @@ CREATE TABLE submission CREATE TABLE validation_test_result ( id bigint not NULL AUTO_INCREMENT, - blueprint_name varchar(20) not NULL, - version text not NULL, + blueprint_instance_id bigint not NULL, + all_layers boolean, lab_id bigint not NULL, timestamp text, - all_layers boolean, optional boolean, result boolean, 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) REFERENCES submission (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT blueprint_instance_id_fk FOREIGN KEY (blueprint_instance_id) + REFERENCES blueprint_instance (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, unique (timestamp, lab_id) );