2 * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 SET FOREIGN_KEY_CHECKS=1;
21 DROP TABLE IF EXISTS submission;
22 DROP TABLE IF EXISTS blueprint_instance_for_validation;
23 DROP TABLE IF EXISTS blueprint;
24 DROP TABLE IF EXISTS silo;
25 DROP TABLE IF EXISTS timeslot;
26 DROP TABLE IF EXISTS lab;
29 id bigint not NULL AUTO_INCREMENT,
31 CONSTRAINT id_pk PRIMARY KEY (id)
34 create table timeslot (
35 id bigint not NULL AUTO_INCREMENT,
38 lab_id bigint not NULL,
39 CONSTRAINT id_pk PRIMARY KEY (id),
40 CONSTRAINT lab_id_fk FOREIGN KEY (lab_id)
41 REFERENCES lab (id) MATCH SIMPLE
42 ON UPDATE NO ACTION ON DELETE NO ACTION
46 id bigint not NULL AUTO_INCREMENT,
48 lab_id bigint not NULL,
49 CONSTRAINT id_pk PRIMARY KEY (id),
50 CONSTRAINT lab_id_fk2 FOREIGN KEY (lab_id)
51 REFERENCES lab (id) MATCH SIMPLE
52 ON UPDATE NO ACTION ON DELETE NO ACTION
55 CREATE TABLE blueprint
57 id bigint not NULL AUTO_INCREMENT,
58 blueprint_name varchar(20) not NULL unique,
59 CONSTRAINT id_pk PRIMARY KEY (id)
62 CREATE TABLE blueprint_instance_for_validation
64 id bigint not NULL AUTO_INCREMENT,
65 blueprint_id bigint not NULL,
66 version text not NULL,
68 layer_description text not NULL,
69 CONSTRAINT id_pk PRIMARY KEY (id),
70 CONSTRAINT blueprint_id_fk FOREIGN KEY (blueprint_id)
71 REFERENCES blueprint (id) MATCH SIMPLE
72 ON UPDATE NO ACTION ON DELETE NO ACTION
75 CREATE TABLE submission
77 id bigint not NULL AUTO_INCREMENT,
79 jenkins_queue_job_item_url text,
80 nexus_result_url text,
81 blueprint_instance_for_validation_id bigint not NULL,
82 timeslot_id bigint not NULL,
83 CONSTRAINT id_pk PRIMARY KEY (id),
84 CONSTRAINT blueprint_instance_for_validation_id_fk FOREIGN KEY (blueprint_instance_for_validation_id)
85 REFERENCES blueprint_instance_for_validation (id) MATCH SIMPLE
86 ON UPDATE NO ACTION ON DELETE NO ACTION,
87 CONSTRAINT timeslot_id_fk FOREIGN KEY (timeslot_id)
88 REFERENCES timeslot (id) MATCH SIMPLE
89 ON UPDATE NO ACTION ON DELETE NO ACTION