[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 insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (21, 'New Submission', 1, 10, 'newSubmission', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'icon-building-home');
93 insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (22, 'Committed Submissions', 1, 10, 'committedSubmissions', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'icon-building-home');
94 insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (23, 'Validation Results', 1, 10, 'report.htm', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', 'icon-misc-piechart');
95 insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (24, 'Get by submission id', 23, 10, 'getBySubmissionId', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png');
96 insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (25, 'Get by blueprint name', 23, 10, '', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png');
97 insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (26, 'Get by layer', 23, 10, '', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png');
98 insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (27, 'Get by execution dates', 23, 10, '', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png');
99 insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (28, 'Get by number of successful runs', 23, 10, '', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png');
100 insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (29, 'Get by number of successful last runs', 23, 10, '', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png');
101 insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (30, 'Get by number of failed last runs', 23, 10, '', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png');
102 insert into fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (31, 'Get all', 23, 10, '', 'menu_tab', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', '/static/fusion/images/reports.png');
103
104 -- fn_user
105 Insert into fn_user (USER_ID,ORG_ID,MANAGER_ID,FIRST_NAME,MIDDLE_NAME,LAST_NAME,PHONE,FAX,CELLULAR,EMAIL,ADDRESS_ID,ALERT_METHOD_CD,HRID,ORG_USER_ID,ORG_CODE,LOGIN_ID,LOGIN_PWD,LAST_LOGIN_DATE,ACTIVE_YN,CREATED_ID,CREATED_DATE,MODIFIED_ID,MODIFIED_DATE,IS_INTERNAL_YN,ADDRESS_LINE_1,ADDRESS_LINE_2,CITY,STATE_CD,ZIP_CODE,COUNTRY_CD,LOCATION_CLLI,ORG_MANAGER_USERID,COMPANY,DEPARTMENT_NAME,JOB_TITLE,TIMEZONE,DEPARTMENT,BUSINESS_UNIT,BUSINESS_UNIT_NAME,COST_CENTER,FIN_LOC_CODE,SILO_STATUS) values (2,null,null,'akraino',null,null,null,null,null,null,null,null,null,'akraino',null,'akraino','akraino_password',now(),'Y',null,now(),1,now(),'N',null,null,null,'NJ',null,'US',null,null,null,null,null,10,null,null,null,null,null,null);
106
107 -- fn_role
108 Insert into fn_role (ROLE_ID,ROLE_NAME,ACTIVE_YN,PRIORITY) values (17,'Blueprint Validation UI user','Y',5);
109
110 -- fn_role_function
111 Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (17,'menu_home');
112 Insert into fn_role_function (ROLE_ID,FUNCTION_CD) values (17,'menu_tab');
113
114 -- fn_user_role
115 Insert into fn_user_role (USER_ID,ROLE_ID,PRIORITY,APP_ID) values (2,17,null,1);
116
117 commit;