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