blob: 1652dc18c38db165c575afa565ca5cbdcfd56bd8 [file] [log] [blame]
saul.gill6238df42021-09-21 15:09:55 +01001/*
2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2021 Nordix Foundation
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * 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.
15 *
16 * SPDX-License-Identifier: Apache-2.0
17 * ============LICENSE_END=========================================================
18 */
sebdet9a4661e2019-10-11 18:23:57 +020019
saul.gill6238df42021-09-21 15:09:55 +010020create table if not exists dictionary (
21 name varchar(255) not null,
22 created_by varchar(255),
23 created_timestamp datetime(6) not null,
24 updated_by varchar(255),
25 updated_timestamp datetime(6) not null,
26 dictionary_second_level integer,
27 dictionary_type varchar(255),
28 primary key (name)
sebdet93b4fd42020-03-25 09:19:34 -070029 ) engine=InnoDB;
30
saul.gill6238df42021-09-21 15:09:55 +010031create table if not exists dictionary_elements (
32 short_name varchar(255) not null,
33 created_by varchar(255),
34 created_timestamp datetime(6) not null,
35 updated_by varchar(255),
36 updated_timestamp datetime(6) not null,
37 description varchar(255) not null,
38 name varchar(255) not null,
39 subdictionary_name varchar(255),
40 type varchar(255) not null,
41 primary key (short_name)
sebdet93b4fd42020-03-25 09:19:34 -070042 ) engine=InnoDB;
43
saul.gill6238df42021-09-21 15:09:55 +010044create table if not exists dictionary_to_dictionaryelements (
45 dictionary_name varchar(255) not null,
46 dictionary_element_short_name varchar(255) not null,
47 primary key (dictionary_name, dictionary_element_short_name)
sebdet93b4fd42020-03-25 09:19:34 -070048 ) engine=InnoDB;
49
saul.gill6238df42021-09-21 15:09:55 +010050create table if not exists hibernate_sequence (
51 next_val bigint
52) engine=InnoDB;
53
54insert into hibernate_sequence values ( 1 );
55
56create table if not exists loop_element_models (
57 name varchar(255) not null,
58 created_by varchar(255),
59 created_timestamp datetime(6) not null,
60 updated_by varchar(255),
61 updated_timestamp datetime(6) not null,
62 blueprint_yaml MEDIUMTEXT,
63 dcae_blueprint_id varchar(255),
64 loop_element_type varchar(255) not null,
65 short_name varchar(255),
66 primary key (name)
ChrisC0d2232e2019-04-15 13:28:48 +020067 ) engine=InnoDB;
68
saul.gill6238df42021-09-21 15:09:55 +010069create table if not exists loop_logs (
70 id bigint not null,
71 log_component varchar(255) not null,
72 log_instant datetime(6) not null,
73 log_type varchar(255) not null,
74 message MEDIUMTEXT not null,
75 loop_id varchar(255) not null,
76 primary key (id)
sebdet93b4fd42020-03-25 09:19:34 -070077 ) engine=InnoDB;
78
saul.gill6238df42021-09-21 15:09:55 +010079create table if not exists loop_templates (
80 name varchar(255) not null,
81 created_by varchar(255),
82 created_timestamp datetime(6) not null,
83 updated_by varchar(255),
84 updated_timestamp datetime(6) not null,
85 allowed_loop_type varchar(255),
86 blueprint_yaml MEDIUMTEXT,
87 dcae_blueprint_id varchar(255),
88 maximum_instances_allowed integer,
89 svg_representation MEDIUMTEXT,
90 unique_blueprint boolean default false,
91 service_uuid varchar(255),
92 primary key (name)
ChrisC0d2232e2019-04-15 13:28:48 +020093 ) engine=InnoDB;
94
saul.gill6238df42021-09-21 15:09:55 +010095create table if not exists loopelementmodels_to_policymodels (
96 loop_element_name varchar(255) not null,
97 policy_model_type varchar(255) not null,
98 policy_model_version varchar(255) not null,
99 primary key (loop_element_name, policy_model_type, policy_model_version)
sebdet93b4fd42020-03-25 09:19:34 -0700100 ) engine=InnoDB;
101
saul.gill6238df42021-09-21 15:09:55 +0100102create table if not exists loops (
103 name varchar(255) not null,
104 created_by varchar(255),
105 created_timestamp datetime(6) not null,
106 updated_by varchar(255),
107 updated_timestamp datetime(6) not null,
108 dcae_deployment_id varchar(255),
109 dcae_deployment_status_url varchar(255),
110 global_properties_json json,
111 last_computed_state varchar(255) not null,
112 svg_representation MEDIUMTEXT,
113 loop_template_name varchar(255) not null,
114 service_uuid varchar(255),
115 primary key (name)
sebdet93b4fd42020-03-25 09:19:34 -0700116 ) engine=InnoDB;
117
saul.gill6238df42021-09-21 15:09:55 +0100118create table if not exists loops_to_microservicepolicies (
119 loop_name varchar(255) not null,
120 microservicepolicy_name varchar(255) not null,
121 primary key (loop_name, microservicepolicy_name)
ChrisC0d2232e2019-04-15 13:28:48 +0200122 ) engine=InnoDB;
123
saul.gill6238df42021-09-21 15:09:55 +0100124create table if not exists looptemplates_to_loopelementmodels (
125 loop_element_model_name varchar(255) not null,
126 loop_template_name varchar(255) not null,
127 flow_order integer not null,
128 primary key (loop_element_model_name, loop_template_name)
sebdet93b4fd42020-03-25 09:19:34 -0700129 ) engine=InnoDB;
130
saul.gill6238df42021-09-21 15:09:55 +0100131create table if not exists micro_service_policies (
132 name varchar(255) not null,
133 created_by varchar(255),
134 created_timestamp datetime(6) not null,
135 updated_by varchar(255),
136 updated_timestamp datetime(6) not null,
137 configurations_json json,
138 json_representation json not null,
139 pdp_group varchar(255),
140 pdp_sub_group varchar(255),
141 context varchar(255),
142 dcae_blueprint_id varchar(255),
143 dcae_deployment_id varchar(255),
144 dcae_deployment_status_url varchar(255),
145 device_type_scope varchar(255),
146 shared bit not null,
147 loop_element_model_id varchar(255),
148 policy_model_type varchar(255),
149 policy_model_version varchar(255),
150 primary key (name)
ChrisC0d2232e2019-04-15 13:28:48 +0200151 ) engine=InnoDB;
152
saul.gill6238df42021-09-21 15:09:55 +0100153create table if not exists operational_policies (
154 name varchar(255) not null,
155 created_by varchar(255),
156 created_timestamp datetime(6) not null,
157 updated_by varchar(255),
158 updated_timestamp datetime(6) not null,
159 configurations_json json,
160 json_representation json not null,
161 pdp_group varchar(255),
162 pdp_sub_group varchar(255),
163 loop_element_model_id varchar(255),
164 policy_model_type varchar(255),
165 policy_model_version varchar(255),
166 loop_id varchar(255) not null,
167 primary key (name)
ChrisC0d2232e2019-04-15 13:28:48 +0200168 ) engine=InnoDB;
169
saul.gill6238df42021-09-21 15:09:55 +0100170create table if not exists policy_models (
171 policy_model_type varchar(255) not null,
172 version varchar(255) not null,
173 created_by varchar(255),
174 created_timestamp datetime(6) not null,
175 updated_by varchar(255),
176 updated_timestamp datetime(6) not null,
177 policy_acronym varchar(255),
178 policy_tosca MEDIUMTEXT,
179 policy_pdp_group json,
180 primary key (policy_model_type, version)
ChrisC0d2232e2019-04-15 13:28:48 +0200181 ) engine=InnoDB;
182
saul.gill6238df42021-09-21 15:09:55 +0100183create table if not exists services (
184 service_uuid varchar(255) not null,
185 name varchar(255) not null,
186 resource_details json,
187 service_details json,
188 version varchar(255),
189 primary key (service_uuid)
sebdet93b4fd42020-03-25 09:19:34 -0700190 ) engine=InnoDB;
191
saul.gill6238df42021-09-21 15:09:55 +0100192alter table dictionary_to_dictionaryelements
193 add constraint FK68hjjinnm8nte2owstd0xwp23
194 foreign key (dictionary_element_short_name)
195 references dictionary_elements (short_name);
sebdet93b4fd42020-03-25 09:19:34 -0700196
saul.gill6238df42021-09-21 15:09:55 +0100197alter table dictionary_to_dictionaryelements
198 add constraint FKtqfxg46gsxwlm2gkl6ne3cxfe
199 foreign key (dictionary_name)
200 references dictionary (name);
sebdet93b4fd42020-03-25 09:19:34 -0700201
saul.gill6238df42021-09-21 15:09:55 +0100202alter table loop_logs
203 add constraint FK1j0cda46aickcaoxqoo34khg2
204 foreign key (loop_id)
205 references loops (name);
sebdet93b4fd42020-03-25 09:19:34 -0700206
saul.gill6238df42021-09-21 15:09:55 +0100207alter table loop_templates
208 add constraint FKn692dk6281wvp1o95074uacn6
209 foreign key (service_uuid)
210 references services (service_uuid);
ChrisC0d2232e2019-04-15 13:28:48 +0200211
saul.gill6238df42021-09-21 15:09:55 +0100212alter table loopelementmodels_to_policymodels
213 add constraint FK23j2q74v6kaexefy0tdabsnda
214 foreign key (policy_model_type, policy_model_version)
215 references policy_models (policy_model_type, version);
sebdet93b4fd42020-03-25 09:19:34 -0700216
saul.gill6238df42021-09-21 15:09:55 +0100217alter table loopelementmodels_to_policymodels
218 add constraint FKjag1iu0olojfwryfkvb5o0rk5
219 foreign key (loop_element_name)
220 references loop_element_models (name);
sebdet93b4fd42020-03-25 09:19:34 -0700221
saul.gill6238df42021-09-21 15:09:55 +0100222alter table loops
223 add constraint FK844uwy82wt0l66jljkjqembpj
224 foreign key (loop_template_name)
225 references loop_templates (name);
sebdet93b4fd42020-03-25 09:19:34 -0700226
saul.gill6238df42021-09-21 15:09:55 +0100227alter table loops
228 add constraint FK4b9wnqopxogwek014i1shqw7w
229 foreign key (service_uuid)
230 references services (service_uuid);
sebdet93b4fd42020-03-25 09:19:34 -0700231
saul.gill6238df42021-09-21 15:09:55 +0100232alter table loops_to_microservicepolicies
233 add constraint FKle255jmi7b065fwbvmwbiehtb
234 foreign key (microservicepolicy_name)
235 references micro_service_policies (name);
sebdet93b4fd42020-03-25 09:19:34 -0700236
saul.gill6238df42021-09-21 15:09:55 +0100237alter table loops_to_microservicepolicies
238 add constraint FK8avfqaf7xl71l7sn7a5eri68d
239 foreign key (loop_name)
240 references loops (name);
ChrisC0d2232e2019-04-15 13:28:48 +0200241
saul.gill6238df42021-09-21 15:09:55 +0100242alter table looptemplates_to_loopelementmodels
243 add constraint FK1k7nbrbugvqa0xfxkq3cj1yn9
244 foreign key (loop_element_model_name)
245 references loop_element_models (name);
ChrisC0d2232e2019-04-15 13:28:48 +0200246
saul.gill6238df42021-09-21 15:09:55 +0100247alter table looptemplates_to_loopelementmodels
248 add constraint FKj29yxyw0x7ue6mwgi6d3qg748
249 foreign key (loop_template_name)
250 references loop_templates (name);
sebdet93b4fd42020-03-25 09:19:34 -0700251
saul.gill6238df42021-09-21 15:09:55 +0100252alter table micro_service_policies
253 add constraint FKqvvdypacbww07fuv8xvlvdjgl
254 foreign key (loop_element_model_id)
255 references loop_element_models (name);
sebdet93b4fd42020-03-25 09:19:34 -0700256
saul.gill6238df42021-09-21 15:09:55 +0100257alter table micro_service_policies
258 add constraint FKn17j9ufmyhqicb6cvr1dbjvkt
259 foreign key (policy_model_type, policy_model_version)
260 references policy_models (policy_model_type, version);
sebdet93b4fd42020-03-25 09:19:34 -0700261
saul.gill6238df42021-09-21 15:09:55 +0100262alter table operational_policies
263 add constraint FKi9kh7my40737xeuaye9xwbnko
264 foreign key (loop_element_model_id)
265 references loop_element_models (name);
sebdet93b4fd42020-03-25 09:19:34 -0700266
saul.gill6238df42021-09-21 15:09:55 +0100267alter table operational_policies
268 add constraint FKlsyhfkoqvkwj78ofepxhoctip
269 foreign key (policy_model_type, policy_model_version)
270 references policy_models (policy_model_type, version);
sebdet93b4fd42020-03-25 09:19:34 -0700271
saul.gill6238df42021-09-21 15:09:55 +0100272alter table operational_policies
273 add constraint FK1ddoggk9ni2bnqighv6ecmuwu
274 foreign key (loop_id)
275 references loops (name);