Merge "[RECV-94] Separate docker/robot invoking"
[validation.git] / ui / db-scripts / akraino_blueprint_validation_db.sql
1 /*
2  * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 SET FOREIGN_KEY_CHECKS=1;
18
19 use akraino;
20
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;
27
28 create table lab (
29    id bigint not NULL AUTO_INCREMENT,
30    lab text not NULL,
31    CONSTRAINT id_pk PRIMARY KEY (id)
32 );
33
34 create table timeslot (
35    id bigint not NULL AUTO_INCREMENT,
36    start_date_time text,
37    duration text,
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
43 );
44
45 create table silo (
46    id bigint not NULL AUTO_INCREMENT,
47    silo text not NULL,
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
53 );
54
55 CREATE TABLE blueprint
56 (
57    id bigint not NULL AUTO_INCREMENT,
58    blueprint_name varchar(20) not NULL unique,
59    CONSTRAINT id_pk PRIMARY KEY (id)
60 );
61
62 CREATE TABLE blueprint_instance_for_validation
63 (
64    id bigint not NULL AUTO_INCREMENT,
65    blueprint_id bigint not NULL,
66    version text not NULL,
67    layer 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
73 );
74
75 CREATE TABLE submission
76 (
77    id bigint not NULL AUTO_INCREMENT,
78    status text not NULL,
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
90 );
91
92 commit;