Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 1 | # |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 2 | # Create CLDS database objects (tables, etc.) |
| 3 | # |
| 4 | # |
| 5 | CREATE DATABASE `camundabpm`; |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 6 | USE `camundabpm`; |
| 7 | DROP USER 'camunda'; |
| 8 | CREATE USER 'camunda'; |
| 9 | GRANT ALL on camundabpm.* to 'camunda' identified by 'ndMSpw4CAM' with GRANT OPTION; |
| 10 | FLUSH PRIVILEGES; |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 11 | |
| 12 | CREATE DATABASE `cldsdb4`; |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 13 | USE `cldsdb4`; |
| 14 | DROP USER 'clds'; |
| 15 | CREATE USER 'clds'; |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 16 | GRANT ALL on cldsdb4.* to 'clds' identified by 'sidnnd83K' with GRANT OPTION; |
| 17 | GRANT SELECT on mysql.proc TO 'clds'; |
| 18 | FLUSH PRIVILEGES; |
| 19 | |
| 20 | |
| 21 | CREATE TABLE template ( |
| 22 | template_id VARCHAR(36) NOT NULL, |
| 23 | template_name VARCHAR(80) NOT NULL, |
| 24 | template_bpmn_id VARCHAR(36) NULL, |
| 25 | template_image_id VARCHAR(36) NULL, |
| 26 | template_doc_id VARCHAR(36) NULL, |
| 27 | PRIMARY KEY (template_id), |
| 28 | UNIQUE (template_name) |
| 29 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 30 | |
| 31 | CREATE TABLE template_bpmn ( |
| 32 | template_bpmn_id VARCHAR(36) NOT NULL, |
| 33 | template_id VARCHAR(36) NOT NULL, |
| 34 | template_bpmn_text MEDIUMTEXT NOT NULL, |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 35 | user_id VARCHAR(80), |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 36 | timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
| 37 | PRIMARY KEY (template_bpmn_id) |
| 38 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 39 | |
| 40 | CREATE TABLE template_image ( |
| 41 | template_image_id VARCHAR(36) NOT NULL, |
| 42 | template_id VARCHAR(36) NOT NULL, |
| 43 | template_image_text MEDIUMTEXT NULL, |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 44 | user_id VARCHAR(80), |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 45 | timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
| 46 | PRIMARY KEY (template_image_id) |
| 47 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 48 | |
| 49 | CREATE TABLE template_doc ( |
| 50 | template_doc_id VARCHAR(36) NOT NULL, |
| 51 | template_id VARCHAR(36) NOT NULL, |
| 52 | template_doc_text MEDIUMTEXT NULL, |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 53 | user_id VARCHAR(80), |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 54 | timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
| 55 | PRIMARY KEY (template_doc_id) |
| 56 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 57 | |
| 58 | CREATE TABLE model ( |
| 59 | model_id VARCHAR(36) NOT NULL, |
| 60 | model_name VARCHAR(80) NOT NULL, |
| 61 | template_id VARCHAR(36) NULL, |
| 62 | model_prop_id VARCHAR(36) NULL, |
| 63 | model_blueprint_id VARCHAR(36) NULL, |
| 64 | event_id VARCHAR(36) NULL, |
| 65 | control_name_prefix VARCHAR(80) NULL, |
| 66 | control_name_uuid VARCHAR(36) NOT NULL, |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 67 | service_type_id VARCHAR(80) NULL, |
| 68 | deployment_id VARCHAR(80) NULL, |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 69 | PRIMARY KEY (model_id), |
| 70 | UNIQUE (model_name), |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 71 | UNIQUE (control_name_uuid), |
| 72 | UNIQUE (service_type_id), |
| 73 | UNIQUE (deployment_id) |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 74 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 75 | |
| 76 | CREATE TABLE model_properties ( |
| 77 | model_prop_id VARCHAR(36) NOT NULL, |
| 78 | model_id VARCHAR(36) NOT NULL, |
| 79 | model_prop_text MEDIUMTEXT NULL, |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 80 | user_id VARCHAR(80), |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 81 | timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
| 82 | PRIMARY KEY (model_prop_id) |
| 83 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 84 | |
| 85 | CREATE TABLE model_blueprint ( |
| 86 | model_blueprint_id VARCHAR(36) NOT NULL, |
| 87 | model_id VARCHAR(36) NOT NULL, |
| 88 | model_blueprint_text MEDIUMTEXT NULL, |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 89 | user_id VARCHAR(80), |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 90 | timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
| 91 | PRIMARY KEY (model_blueprint_id) |
| 92 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 93 | |
| 94 | CREATE TABLE model_instance ( |
| 95 | model_instance_id VARCHAR(36) NOT NULL, |
| 96 | model_id VARCHAR(36) NOT NULL, |
| 97 | vm_name VARCHAR(250) NOT NULL, |
| 98 | location VARCHAR(250) NULL, |
| 99 | timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
| 100 | PRIMARY KEY (model_instance_id), |
| 101 | UNIQUE (model_id, vm_name) |
| 102 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 103 | |
| 104 | CREATE TABLE event ( |
| 105 | event_id VARCHAR(36) NOT NULL, |
| 106 | model_id VARCHAR(36) NULL, |
| 107 | action_cd VARCHAR(80) NOT NULL, |
| 108 | action_state_cd VARCHAR(80) NULL, |
| 109 | prev_event_id VARCHAR(36) NULL, |
| 110 | process_instance_id VARCHAR(80) NULL, |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 111 | user_id VARCHAR(80) NULL, |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 112 | timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, |
| 113 | PRIMARY KEY (event_id) |
| 114 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 115 | |
| 116 | CREATE TABLE clds_service_cache ( |
| 117 | invariant_service_id VARCHAR(36) NOT NULL, |
| 118 | service_id VARCHAR(36) NULL, |
| 119 | timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, |
| 120 | object_data MEDIUMBLOB NULL, |
| 121 | PRIMARY KEY (invariant_service_id) |
| 122 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 123 | |
| 124 | ALTER TABLE template |
| 125 | ADD CONSTRAINT template_bpmn_id_fkey01 |
| 126 | FOREIGN KEY (template_bpmn_id) |
| 127 | REFERENCES template_bpmn (template_bpmn_id); |
| 128 | |
| 129 | ALTER TABLE template |
| 130 | ADD CONSTRAINT template_image_id_fkey01 |
| 131 | FOREIGN KEY (template_image_id) |
| 132 | REFERENCES template_image (template_image_id); |
| 133 | |
| 134 | ALTER TABLE template |
| 135 | ADD CONSTRAINT template_doc_id_fkey01 |
| 136 | FOREIGN KEY (template_doc_id) |
| 137 | REFERENCES template_doc (template_doc_id); |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 138 | |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 139 | ALTER TABLE template_bpmn |
| 140 | ADD CONSTRAINT template_id_fkey02 |
| 141 | FOREIGN KEY (template_id) |
| 142 | REFERENCES template (template_id); |
| 143 | |
| 144 | ALTER TABLE template_image |
| 145 | ADD CONSTRAINT template_id_fkey03 |
| 146 | FOREIGN KEY (template_id) |
| 147 | REFERENCES template (template_id); |
| 148 | |
| 149 | ALTER TABLE template_doc |
| 150 | ADD CONSTRAINT template_id_fkey04 |
| 151 | FOREIGN KEY (template_id) |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 152 | REFERENCES template (template_id); |
| 153 | |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 154 | ALTER TABLE model |
| 155 | ADD CONSTRAINT template_id_fkey01 |
| 156 | FOREIGN KEY (template_id) |
| 157 | REFERENCES template (template_id); |
| 158 | |
| 159 | ALTER TABLE model |
| 160 | ADD CONSTRAINT model_prop_id_fkey01 |
| 161 | FOREIGN KEY (model_prop_id) |
| 162 | REFERENCES model_properties (model_prop_id); |
| 163 | |
| 164 | ALTER TABLE model |
| 165 | ADD CONSTRAINT model_blueprint_id_fkey01 |
| 166 | FOREIGN KEY (model_blueprint_id) |
| 167 | REFERENCES model_blueprint (model_blueprint_id); |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 168 | |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 169 | ALTER TABLE model |
| 170 | ADD CONSTRAINT event_id_fkey01 |
| 171 | FOREIGN KEY (event_id) |
| 172 | REFERENCES event (event_id); |
| 173 | |
| 174 | ALTER TABLE model_properties |
| 175 | ADD CONSTRAINT model_id_fkey01 |
| 176 | FOREIGN KEY (model_id) |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 177 | REFERENCES model (model_id); |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 178 | |
| 179 | ALTER TABLE model_blueprint |
| 180 | ADD CONSTRAINT model_id_fkey02 |
| 181 | FOREIGN KEY (model_id) |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 182 | REFERENCES model (model_id); |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 183 | |
| 184 | ALTER TABLE model_instance |
| 185 | ADD CONSTRAINT model_id_fkey04 |
| 186 | FOREIGN KEY (model_id) |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 187 | REFERENCES model (model_id); |
| 188 | |
ChrisC | 5e9feb2 | 2017-06-21 02:38:57 -0700 | [diff] [blame] | 189 | ALTER TABLE event |
| 190 | ADD CONSTRAINT model_id_fkey03 |
| 191 | FOREIGN KEY (model_id) |
Determe, Sebastien (sd378r) | b3a21f7 | 2017-08-08 02:58:27 -0700 | [diff] [blame] | 192 | REFERENCES model (model_id); |