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 drop sequence IF EXISTS akraino.seq_timeslot;
18 drop sequence IF EXISTS akraino.seq_blueprint;
19 drop sequence IF EXISTS akraino.seq_blueprint_instance;
20 drop sequence IF EXISTS akraino.seq_submission;
22 drop table IF EXISTS akraino.submission;
23 drop table IF EXISTS akraino.blueprint_instance;
24 drop table IF EXISTS akraino.blueprint;
25 drop table IF EXISTS akraino.timeslot;
27 CREATE SCHEMA IF NOT EXISTS akraino
28 AUTHORIZATION postgres;
30 CREATE TABLE akraino.timeslot
32 timeslot_id bigint not NULL unique,
33 start_date_time text not NULL,
34 duration int not NULL,
41 ALTER TABLE akraino.timeslot
44 CREATE TABLE akraino.blueprint
46 blueprint_id bigint not NULL,
47 blueprint_name text not NULL unique,
48 CONSTRAINT blueprint_id_pk PRIMARY KEY (blueprint_id)
54 ALTER TABLE akraino.blueprint
57 CREATE TABLE akraino.blueprint_instance
59 blueprint_instance_id bigint not NULL,
60 blueprint_id bigint not NULL,
61 version text not NULL,
63 layer_description text not NULL,
64 timeslot_id bigint not NULL unique,
65 CONSTRAINT blueprint_instance_id_pk PRIMARY KEY (blueprint_instance_id),
66 CONSTRAINT blueprint_id_fk FOREIGN KEY (blueprint_id)
67 REFERENCES akraino.blueprint (blueprint_id) MATCH SIMPLE
68 ON UPDATE NO ACTION ON DELETE NO ACTION,
69 CONSTRAINT timeslot_id_fk FOREIGN KEY (timeslot_id)
70 REFERENCES akraino.timeslot (timeslot_id) MATCH SIMPLE
71 ON UPDATE NO ACTION ON DELETE NO ACTION
77 ALTER TABLE akraino.blueprint_instance
80 CREATE TABLE akraino.submission
82 submission_id bigint not NULL,
84 jenkins_queue_job_item_url text,
85 nexus_result_url text,
86 blueprint_instance_id bigint not NULL,
87 CONSTRAINT submission_id_pk PRIMARY KEY (submission_id),
88 CONSTRAINT blueprint_instance_id_fk FOREIGN KEY (blueprint_instance_id)
89 REFERENCES akraino.blueprint_instance (blueprint_instance_id) MATCH SIMPLE
90 ON UPDATE NO ACTION ON DELETE NO ACTION
96 ALTER TABLE akraino.submission
99 CREATE SEQUENCE akraino.seq_timeslot
100 START WITH 1 INCREMENT BY 1;
102 CREATE SEQUENCE akraino.seq_blueprint
103 START WITH 1 INCREMENT BY 1;
105 CREATE SEQUENCE akraino.seq_blueprint_instance
106 START WITH 1 INCREMENT BY 1;
108 CREATE SEQUENCE akraino.seq_submission
109 START WITH 1 INCREMENT BY 1;
111 insert into akraino.timeslot values(1, now(), 10, 0); /* stands for AT&T lab */
112 insert into akraino.timeslot values(2, now(), 1000, 0); /* stands for AT&T lab */
113 insert into akraino.timeslot values(3, now(), 10000, 0); /* stands for AT&T lab */
114 insert into akraino.timeslot values(4, now(), 100000, 0); /* stands for AT&T lab */
115 insert into akraino.timeslot values(5, now(), 100000, 0); /* stands for AT&T lab */
117 insert into akraino.blueprint (blueprint_id, blueprint_name) values(1, 'dummy');
118 insert into akraino.blueprint (blueprint_id, blueprint_name) values(2, 'Unicycle');
119 insert into akraino.blueprint (blueprint_id, blueprint_name) values(3, 'REC');
121 insert into akraino.blueprint_instance (blueprint_instance_id, blueprint_id, version, layer, layer_description, timeslot_id) values(1, 1, '0.0.2-SNAPSHOT', 0, 'Dell Hardware', 1); /* 0 Stands for hardware layer */
122 insert into akraino.blueprint_instance (blueprint_instance_id, blueprint_id, version, layer, layer_description, timeslot_id) values(2, 2, '0.0.1-SNAPSHOT', 0, 'Dell Hardware', 2); /* 0 Stands for hardware layer */
123 insert into akraino.blueprint_instance (blueprint_instance_id, blueprint_id, version, layer, layer_description, timeslot_id) values(3, 2, '0.0.7-SNAPSHOT', 1, 'CentOS Linux 7 (Core)', 3); /* 1 Stands for OS layer */
124 insert into akraino.blueprint_instance (blueprint_instance_id, blueprint_id, version, layer, layer_description, timeslot_id) values(4, 3, '0.0.4-SNAPSHOT', 2, 'K8s with High Availability Ingress controller', 4); /* 2 Stands for k8s layer */
125 insert into akraino.blueprint_instance (blueprint_instance_id, blueprint_id, version, layer, layer_description, timeslot_id) values(5, 3, '0.0.8-SNAPSHOT', 2, 'K8s with High Availability Ingress controller', 5); /* 2 Stands for k8s layer */