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 | |
| 33 | create table loop_logs ( |
| 34 | id bigint not null, |
sebdet | 09bc845 | 2019-05-23 17:34:07 +0200 | [diff] [blame] | 35 | log_component varchar(255) not null, |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 36 | log_instant datetime(6) not null, |
| 37 | log_type varchar(255) not null, |
sebdet | 584cc4a | 2019-05-03 14:32:53 +0200 | [diff] [blame] | 38 | message MEDIUMTEXT not null, |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 39 | loop_id varchar(255) not null, |
| 40 | primary key (id) |
| 41 | ) engine=InnoDB; |
| 42 | |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 43 | create table loop_templates ( |
| 44 | name varchar(255) not null, |
| 45 | created_by varchar(255), |
| 46 | created_timestamp datetime(6) not null, |
| 47 | updated_by varchar(255), |
| 48 | updated_timestamp datetime(6) not null, |
| 49 | blueprint_yaml MEDIUMTEXT not null, |
| 50 | maximum_instances_allowed integer, |
| 51 | svg_representation MEDIUMTEXT, |
| 52 | service_uuid varchar(255), |
| 53 | primary key (name) |
| 54 | ) engine=InnoDB; |
| 55 | |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 56 | create table loops ( |
| 57 | name varchar(255) not null, |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 58 | created_by varchar(255), |
| 59 | created_timestamp datetime(6) not null, |
| 60 | updated_by varchar(255), |
| 61 | updated_timestamp datetime(6) not null, |
sebdet | 92cc418 | 2019-03-12 15:08:11 +0100 | [diff] [blame] | 62 | blueprint_yaml MEDIUMTEXT not null, |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 63 | dcae_blueprint_id varchar(255), |
| 64 | dcae_deployment_id varchar(255), |
| 65 | dcae_deployment_status_url varchar(255), |
| 66 | global_properties_json json, |
| 67 | last_computed_state varchar(255) not null, |
sebdet | d022281 | 2019-03-12 16:35:25 +0100 | [diff] [blame] | 68 | svg_representation MEDIUMTEXT, |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 69 | loop_template_name varchar(255), |
xuegao | 289e8e1 | 2019-11-08 13:10:36 +0100 | [diff] [blame] | 70 | service_uuid varchar(255), |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 71 | primary key (name) |
| 72 | ) engine=InnoDB; |
| 73 | |
| 74 | create table loops_microservicepolicies ( |
| 75 | loop_id varchar(255) not null, |
| 76 | microservicepolicy_id varchar(255) not null, |
| 77 | primary key (loop_id, microservicepolicy_id) |
| 78 | ) engine=InnoDB; |
| 79 | |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 80 | create table micro_service_models ( |
| 81 | name varchar(255) not null, |
| 82 | created_by varchar(255), |
| 83 | created_timestamp datetime(6) not null, |
| 84 | updated_by varchar(255), |
| 85 | updated_timestamp datetime(6) not null, |
| 86 | blueprint_yaml varchar(255) not null, |
| 87 | policy_type varchar(255) not null, |
| 88 | policy_model_type varchar(255), |
| 89 | policy_model_version varchar(255), |
| 90 | primary key (name) |
| 91 | ) engine=InnoDB; |
| 92 | |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 93 | create table micro_service_policies ( |
| 94 | name varchar(255) not null, |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 95 | created_by varchar(255), |
| 96 | created_timestamp datetime(6) not null, |
| 97 | updated_by varchar(255), |
| 98 | updated_timestamp datetime(6) not null, |
| 99 | context varchar(255), |
sebdet | 8d74bbf | 2020-01-17 15:08:39 +0100 | [diff] [blame] | 100 | dcae_deployment_id varchar(255), |
| 101 | dcae_deployment_status_url varchar(255), |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 102 | device_type_scope varchar(255), |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 103 | json_representation json not null, |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 104 | policy_model_type varchar(255) not null, |
sebdet | 92cc418 | 2019-03-12 15:08:11 +0100 | [diff] [blame] | 105 | policy_tosca MEDIUMTEXT not null, |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 106 | properties json, |
| 107 | shared bit not null, |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 108 | micro_service_model_id varchar(255), |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 109 | primary key (name) |
| 110 | ) engine=InnoDB; |
| 111 | |
| 112 | create table operational_policies ( |
| 113 | name varchar(255) not null, |
| 114 | configurations_json json, |
xuegao | 62a0b7c | 2019-12-18 11:17:53 +0100 | [diff] [blame] | 115 | json_representation json not null, |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 116 | loop_id varchar(255) not null, |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 117 | policy_model_type varchar(255), |
| 118 | policy_model_version varchar(255), |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 119 | primary key (name) |
| 120 | ) engine=InnoDB; |
| 121 | |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 122 | create table policy_models ( |
| 123 | policy_model_type varchar(255) not null, |
| 124 | version varchar(255) not null, |
| 125 | created_by varchar(255), |
| 126 | created_timestamp datetime(6) not null, |
| 127 | updated_by varchar(255), |
| 128 | updated_timestamp datetime(6) not null, |
| 129 | policy_acronym varchar(255), |
| 130 | policy_tosca MEDIUMTEXT, |
| 131 | policy_variant varchar(255), |
| 132 | primary key (policy_model_type, version) |
| 133 | ) engine=InnoDB; |
| 134 | |
xuegao | 289e8e1 | 2019-11-08 13:10:36 +0100 | [diff] [blame] | 135 | create table services ( |
| 136 | service_uuid varchar(255) not null, |
| 137 | name varchar(255) not null, |
| 138 | resource_details json, |
| 139 | service_details json, |
xuegao | 69c2499 | 2019-12-06 10:40:49 +0100 | [diff] [blame] | 140 | version varchar(255), |
xuegao | 289e8e1 | 2019-11-08 13:10:36 +0100 | [diff] [blame] | 141 | primary key (service_uuid) |
| 142 | ) engine=InnoDB; |
| 143 | |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 144 | create table templates_microservicemodels ( |
| 145 | loop_template_name varchar(255) not null, |
| 146 | micro_service_model_name varchar(255) not null, |
| 147 | flow_order integer not null, |
| 148 | primary key (loop_template_name, micro_service_model_name) |
| 149 | ) engine=InnoDB; |
| 150 | |
| 151 | alter table dictionary_elements |
| 152 | add constraint UK_qxkrvsrhp26m60apfvxphpl3d unique (short_name); |
| 153 | |
| 154 | alter table dictionary_elements |
| 155 | add constraint FKn87bpgpm9i56w7uko585rbkgn |
| 156 | foreign key (dictionary_id) |
| 157 | references dictionary (name); |
| 158 | |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 159 | alter table loop_logs |
| 160 | add constraint FK1j0cda46aickcaoxqoo34khg2 |
| 161 | foreign key (loop_id) |
| 162 | references loops (name); |
| 163 | |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 164 | alter table loop_templates |
| 165 | add constraint FKn692dk6281wvp1o95074uacn6 |
| 166 | foreign key (service_uuid) |
| 167 | references services (service_uuid); |
| 168 | |
| 169 | alter table loops |
| 170 | add constraint FK844uwy82wt0l66jljkjqembpj |
| 171 | foreign key (loop_template_name) |
| 172 | references loop_templates (name); |
| 173 | |
xuegao | 289e8e1 | 2019-11-08 13:10:36 +0100 | [diff] [blame] | 174 | alter table loops |
| 175 | add constraint FK4b9wnqopxogwek014i1shqw7w |
| 176 | foreign key (service_uuid) |
| 177 | references services (service_uuid); |
| 178 | |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 179 | alter table loops_microservicepolicies |
| 180 | add constraint FKem7tp1cdlpwe28av7ef91j1yl |
| 181 | foreign key (microservicepolicy_id) |
| 182 | references micro_service_policies (name); |
| 183 | |
| 184 | alter table loops_microservicepolicies |
| 185 | add constraint FKsvx91jekgdkfh34iaxtjfgebt |
| 186 | foreign key (loop_id) |
| 187 | references loops (name); |
| 188 | |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 189 | alter table micro_service_models |
| 190 | add constraint FKlkcffpnuavcg65u5o4tr66902 |
| 191 | foreign key (policy_model_type, policy_model_version) |
| 192 | references policy_models (policy_model_type, version); |
| 193 | |
| 194 | alter table micro_service_policies |
| 195 | add constraint FK5p7lipy9m2v7d4n3fvlclwse |
| 196 | foreign key (micro_service_model_id) |
| 197 | references micro_service_models (name); |
| 198 | |
sebdet | b1db9f9 | 2019-03-11 14:33:54 +0100 | [diff] [blame] | 199 | alter table operational_policies |
| 200 | add constraint FK1ddoggk9ni2bnqighv6ecmuwu |
| 201 | foreign key (loop_id) |
| 202 | references loops (name); |
nrpandya | 8256126 | 2019-11-21 11:51:18 -0600 | [diff] [blame] | 203 | |
| 204 | alter table operational_policies |
| 205 | add constraint FKlsyhfkoqvkwj78ofepxhoctip |
| 206 | foreign key (policy_model_type, policy_model_version) |
| 207 | references policy_models (policy_model_type, version); |
| 208 | |
| 209 | alter table templates_microservicemodels |
| 210 | add constraint FKq2gqg5q9jrkx8voosn7x5plqo |
| 211 | foreign key (loop_template_name) |
| 212 | references loop_templates (name); |
| 213 | |
| 214 | alter table templates_microservicemodels |
| 215 | add constraint FKphn3m81suxavmj9c4u06cchju |
| 216 | foreign key (micro_service_model_name) |
| 217 | references micro_service_models (name); |