sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 1 | |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 2 | create table dictionary ( |
| 3 | name varchar(255) not null, |
| 4 | created_by varchar(255), |
| 5 | created_timestamp datetime(6) not null, |
| 6 | updated_by varchar(255), |
| 7 | updated_timestamp datetime(6) not null, |
| 8 | dictionary_second_level integer, |
| 9 | dictionary_type varchar(255), |
| 10 | primary key (name) |
| 11 | ) engine=InnoDB; |
| 12 | |
| 13 | create table dictionary_elements ( |
ash74268 | 3a83e2a | 2020-01-31 15:40:15 +0000 | [diff] [blame] | 14 | short_name varchar(255) not null, |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 15 | created_by varchar(255), |
| 16 | created_timestamp datetime(6) not null, |
| 17 | updated_by varchar(255), |
| 18 | updated_timestamp datetime(6) not null, |
ash74268 | 3a83e2a | 2020-01-31 15:40:15 +0000 | [diff] [blame] | 19 | description varchar(255) not null, |
| 20 | name varchar(255) not null, |
| 21 | subdictionary_name varchar(255), |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 22 | type varchar(255) not null, |
ash74268 | 3a83e2a | 2020-01-31 15:40:15 +0000 | [diff] [blame] | 23 | primary key (short_name) |
| 24 | ) engine=InnoDB; |
| 25 | |
| 26 | create table dictionary_to_dictionaryelements ( |
| 27 | dictionary_name varchar(255) not null, |
| 28 | dictionary_element_short_name varchar(255) not null, |
| 29 | primary key (dictionary_name, dictionary_element_short_name) |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 30 | ) engine=InnoDB; |
| 31 | |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 32 | create table hibernate_sequence ( |
| 33 | next_val bigint |
| 34 | ) engine=InnoDB; |
| 35 | |
| 36 | insert into hibernate_sequence values ( 1 ); |
| 37 | |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 38 | create table loop_element_models ( |
| 39 | name varchar(255) not null, |
| 40 | created_by varchar(255), |
| 41 | created_timestamp datetime(6) not null, |
| 42 | updated_by varchar(255), |
| 43 | updated_timestamp datetime(6) not null, |
sebdet | 5d03e8b | 2020-02-03 20:27:59 +0100 | [diff] [blame] | 44 | blueprint_yaml MEDIUMTEXT, |
sebdet | b9a6531 | 2020-01-28 16:28:21 +0100 | [diff] [blame] | 45 | dcae_blueprint_id varchar(255), |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 46 | loop_element_type varchar(255) not null, |
ash74268 | 3a83e2a | 2020-01-31 15:40:15 +0000 | [diff] [blame] | 47 | short_name varchar(255), |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 48 | primary key (name) |
| 49 | ) engine=InnoDB; |
| 50 | |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 51 | create table loop_logs ( |
| 52 | id bigint not null, |
sebdet | 09bc845 | 2019-05-23 17:34:07 +0200 | [diff] [blame] | 53 | log_component varchar(255) not null, |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 54 | log_instant datetime(6) not null, |
| 55 | log_type varchar(255) not null, |
sebdet | 584cc4a | 2019-05-03 14:32:53 +0200 | [diff] [blame] | 56 | message MEDIUMTEXT not null, |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 57 | loop_id varchar(255) not null, |
| 58 | primary key (id) |
| 59 | ) engine=InnoDB; |
| 60 | |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 61 | create table loop_templates ( |
| 62 | name varchar(255) not null, |
| 63 | created_by varchar(255), |
| 64 | created_timestamp datetime(6) not null, |
| 65 | updated_by varchar(255), |
| 66 | updated_timestamp datetime(6) not null, |
ash74268 | 3a83e2a | 2020-01-31 15:40:15 +0000 | [diff] [blame] | 67 | allowed_loop_type varchar(255), |
xuegao | 9e01ce3 | 2020-01-27 12:10:32 +0100 | [diff] [blame] | 68 | blueprint_yaml MEDIUMTEXT, |
sebdet | b9a6531 | 2020-01-28 16:28:21 +0100 | [diff] [blame] | 69 | dcae_blueprint_id varchar(255), |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 70 | maximum_instances_allowed integer, |
xuegao | 81c1344 | 2020-02-04 15:22:00 +0100 | [diff] [blame] | 71 | unique_blueprint boolean default false, |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 72 | service_uuid varchar(255), |
| 73 | primary key (name) |
| 74 | ) engine=InnoDB; |
| 75 | |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 76 | create table loopelementmodels_to_policymodels ( |
| 77 | loop_element_name varchar(255) not null, |
| 78 | policy_model_type varchar(255) not null, |
| 79 | policy_model_version varchar(255) not null, |
| 80 | primary key (loop_element_name, policy_model_type, policy_model_version) |
| 81 | ) engine=InnoDB; |
| 82 | |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 83 | create table loops ( |
| 84 | name varchar(255) not null, |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 85 | created_by varchar(255), |
| 86 | created_timestamp datetime(6) not null, |
| 87 | updated_by varchar(255), |
| 88 | updated_timestamp datetime(6) not null, |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 89 | dcae_deployment_id varchar(255), |
| 90 | dcae_deployment_status_url varchar(255), |
| 91 | global_properties_json json, |
| 92 | last_computed_state varchar(255) not null, |
xuegao | 81c1344 | 2020-02-04 15:22:00 +0100 | [diff] [blame] | 93 | loop_template_name varchar(255) not null, |
xuegao | 289e8e1 | 2019-11-08 13:10:36 +0100 | [diff] [blame] | 94 | service_uuid varchar(255), |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 95 | primary key (name) |
| 96 | ) engine=InnoDB; |
| 97 | |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 98 | create table loops_to_microservicepolicies ( |
| 99 | loop_name varchar(255) not null, |
| 100 | microservicepolicy_name varchar(255) not null, |
| 101 | primary key (loop_name, microservicepolicy_name) |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 102 | ) engine=InnoDB; |
| 103 | |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 104 | create table looptemplates_to_loopelementmodels ( |
| 105 | loop_element_model_name varchar(255) not null, |
| 106 | loop_template_name varchar(255) not null, |
| 107 | flow_order integer not null, |
| 108 | primary key (loop_element_model_name, loop_template_name) |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 109 | ) engine=InnoDB; |
| 110 | |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 111 | create table micro_service_policies ( |
| 112 | name varchar(255) not null, |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 113 | created_by varchar(255), |
| 114 | created_timestamp datetime(6) not null, |
| 115 | updated_by varchar(255), |
| 116 | updated_timestamp datetime(6) not null, |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 117 | configurations_json json, |
| 118 | json_representation json not null, |
| 119 | pdp_group varchar(255), |
xuegao | 3a26471 | 2020-02-18 14:20:23 +0100 | [diff] [blame] | 120 | pdp_sub_group varchar(255), |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 121 | context varchar(255), |
xuegao | 9e01ce3 | 2020-01-27 12:10:32 +0100 | [diff] [blame] | 122 | dcae_blueprint_id varchar(255), |
sebdet | 8d74bbf | 2020-01-17 15:08:39 +0100 | [diff] [blame] | 123 | dcae_deployment_id varchar(255), |
| 124 | dcae_deployment_status_url varchar(255), |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 125 | device_type_scope varchar(255), |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 126 | shared bit not null, |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 127 | loop_element_model_id varchar(255), |
sebdet | 4e8e11a | 2020-02-17 15:31:28 -0800 | [diff] [blame] | 128 | policy_model_type varchar(255), |
| 129 | policy_model_version varchar(255), |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 130 | primary key (name) |
| 131 | ) engine=InnoDB; |
| 132 | |
| 133 | create table operational_policies ( |
| 134 | name varchar(255) not null, |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 135 | created_by varchar(255), |
| 136 | created_timestamp datetime(6) not null, |
| 137 | updated_by varchar(255), |
| 138 | updated_timestamp datetime(6) not null, |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 139 | configurations_json json, |
xuegao | 62a0b7c | 2019-12-18 11:17:53 +0100 | [diff] [blame] | 140 | json_representation json not null, |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 141 | pdp_group varchar(255), |
xuegao | 3a26471 | 2020-02-18 14:20:23 +0100 | [diff] [blame] | 142 | pdp_sub_group varchar(255), |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 143 | loop_element_model_id varchar(255), |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 144 | policy_model_type varchar(255), |
| 145 | policy_model_version varchar(255), |
sebdet | 897a3e0 | 2020-02-28 06:03:51 -0800 | [diff] [blame] | 146 | loop_id varchar(255) not null, |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 147 | primary key (name) |
| 148 | ) engine=InnoDB; |
| 149 | |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 150 | create table policy_models ( |
| 151 | policy_model_type varchar(255) not null, |
| 152 | version varchar(255) not null, |
| 153 | created_by varchar(255), |
| 154 | created_timestamp datetime(6) not null, |
| 155 | updated_by varchar(255), |
| 156 | updated_timestamp datetime(6) not null, |
| 157 | policy_acronym varchar(255), |
| 158 | policy_tosca MEDIUMTEXT, |
xuegao | 3a26471 | 2020-02-18 14:20:23 +0100 | [diff] [blame] | 159 | policy_pdp_group json, |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 160 | primary key (policy_model_type, version) |
| 161 | ) engine=InnoDB; |
| 162 | |
xuegao | 289e8e1 | 2019-11-08 13:10:36 +0100 | [diff] [blame] | 163 | create table services ( |
| 164 | service_uuid varchar(255) not null, |
| 165 | name varchar(255) not null, |
| 166 | resource_details json, |
| 167 | service_details json, |
xuegao | 69c2499 | 2019-12-06 10:40:49 +0100 | [diff] [blame] | 168 | version varchar(255), |
xuegao | 289e8e1 | 2019-11-08 13:10:36 +0100 | [diff] [blame] | 169 | primary key (service_uuid) |
| 170 | ) engine=InnoDB; |
| 171 | |
ash74268 | 3a83e2a | 2020-01-31 15:40:15 +0000 | [diff] [blame] | 172 | alter table dictionary_to_dictionaryelements |
| 173 | add constraint FK68hjjinnm8nte2owstd0xwp23 |
| 174 | foreign key (dictionary_element_short_name) |
| 175 | references dictionary_elements (short_name); |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 176 | |
ash74268 | 3a83e2a | 2020-01-31 15:40:15 +0000 | [diff] [blame] | 177 | alter table dictionary_to_dictionaryelements |
| 178 | add constraint FKtqfxg46gsxwlm2gkl6ne3cxfe |
| 179 | foreign key (dictionary_name) |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 180 | references dictionary (name); |
| 181 | |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 182 | alter table loop_logs |
| 183 | add constraint FK1j0cda46aickcaoxqoo34khg2 |
| 184 | foreign key (loop_id) |
| 185 | references loops (name); |
| 186 | |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 187 | alter table loop_templates |
| 188 | add constraint FKn692dk6281wvp1o95074uacn6 |
| 189 | foreign key (service_uuid) |
| 190 | references services (service_uuid); |
| 191 | |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 192 | alter table loopelementmodels_to_policymodels |
| 193 | add constraint FK23j2q74v6kaexefy0tdabsnda |
| 194 | foreign key (policy_model_type, policy_model_version) |
| 195 | references policy_models (policy_model_type, version); |
| 196 | |
| 197 | alter table loopelementmodels_to_policymodels |
| 198 | add constraint FKjag1iu0olojfwryfkvb5o0rk5 |
| 199 | foreign key (loop_element_name) |
| 200 | references loop_element_models (name); |
| 201 | |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 202 | alter table loops |
| 203 | add constraint FK844uwy82wt0l66jljkjqembpj |
| 204 | foreign key (loop_template_name) |
| 205 | references loop_templates (name); |
| 206 | |
xuegao | 289e8e1 | 2019-11-08 13:10:36 +0100 | [diff] [blame] | 207 | alter table loops |
| 208 | add constraint FK4b9wnqopxogwek014i1shqw7w |
| 209 | foreign key (service_uuid) |
| 210 | references services (service_uuid); |
| 211 | |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 212 | alter table loops_to_microservicepolicies |
| 213 | add constraint FKle255jmi7b065fwbvmwbiehtb |
| 214 | foreign key (microservicepolicy_name) |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 215 | references micro_service_policies (name); |
| 216 | |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 217 | alter table loops_to_microservicepolicies |
| 218 | add constraint FK8avfqaf7xl71l7sn7a5eri68d |
| 219 | foreign key (loop_name) |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 220 | references loops (name); |
| 221 | |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 222 | alter table looptemplates_to_loopelementmodels |
| 223 | add constraint FK1k7nbrbugvqa0xfxkq3cj1yn9 |
| 224 | foreign key (loop_element_model_name) |
| 225 | references loop_element_models (name); |
| 226 | |
| 227 | alter table looptemplates_to_loopelementmodels |
| 228 | add constraint FKj29yxyw0x7ue6mwgi6d3qg748 |
| 229 | foreign key (loop_template_name) |
| 230 | references loop_templates (name); |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 231 | |
| 232 | alter table micro_service_policies |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 233 | add constraint FKqvvdypacbww07fuv8xvlvdjgl |
| 234 | foreign key (loop_element_model_id) |
| 235 | references loop_element_models (name); |
| 236 | |
sebdet | 4e8e11a | 2020-02-17 15:31:28 -0800 | [diff] [blame] | 237 | alter table micro_service_policies |
| 238 | add constraint FKn17j9ufmyhqicb6cvr1dbjvkt |
| 239 | foreign key (policy_model_type, policy_model_version) |
| 240 | references policy_models (policy_model_type, version); |
| 241 | |
sebdet | cef5b58 | 2020-01-21 12:40:59 +0100 | [diff] [blame] | 242 | alter table operational_policies |
| 243 | add constraint FKi9kh7my40737xeuaye9xwbnko |
| 244 | foreign key (loop_element_model_id) |
| 245 | references loop_element_models (name); |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 246 | |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 247 | alter table operational_policies |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 248 | add constraint FKlsyhfkoqvkwj78ofepxhoctip |
| 249 | foreign key (policy_model_type, policy_model_version) |
| 250 | references policy_models (policy_model_type, version); |
sebdet | 897a3e0 | 2020-02-28 06:03:51 -0800 | [diff] [blame] | 251 | |
| 252 | alter table operational_policies |
| 253 | add constraint FK1ddoggk9ni2bnqighv6ecmuwu |
| 254 | foreign key (loop_id) |
| 255 | references loops (name); |