Benjamin, Max (mb388a) | 5a6a6de | 2018-07-30 15:56:09 -0400 | [diff] [blame] | 1 | |
| 2 | USE `camundabpmn`; |
| 3 | |
| 4 | |
| 5 | create table ACT_GE_PROPERTY ( |
| 6 | NAME_ varchar(64), |
| 7 | VALUE_ varchar(300), |
| 8 | REV_ integer, |
| 9 | primary key (NAME_) |
| 10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 11 | |
| 12 | |
| 13 | create table ACT_GE_BYTEARRAY ( |
| 14 | ID_ varchar(64), |
| 15 | REV_ integer, |
| 16 | NAME_ varchar(255), |
| 17 | DEPLOYMENT_ID_ varchar(64), |
| 18 | BYTES_ LONGBLOB, |
| 19 | GENERATED_ TINYINT, |
| 20 | TENANT_ID_ varchar(64), |
| 21 | primary key (ID_) |
| 22 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 23 | |
| 24 | create table ACT_RE_DEPLOYMENT ( |
| 25 | ID_ varchar(64), |
| 26 | NAME_ varchar(255), |
| 27 | DEPLOY_TIME_ timestamp(3), |
| 28 | SOURCE_ varchar(255), |
| 29 | TENANT_ID_ varchar(64), |
| 30 | primary key (ID_) |
| 31 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 32 | |
| 33 | create table ACT_RU_EXECUTION ( |
| 34 | ID_ varchar(64), |
| 35 | REV_ integer, |
| 36 | PROC_INST_ID_ varchar(64), |
| 37 | BUSINESS_KEY_ varchar(255), |
| 38 | PARENT_ID_ varchar(64), |
| 39 | PROC_DEF_ID_ varchar(64), |
| 40 | SUPER_EXEC_ varchar(64), |
| 41 | SUPER_CASE_EXEC_ varchar(64), |
| 42 | CASE_INST_ID_ varchar(64), |
| 43 | ACT_ID_ varchar(255), |
| 44 | ACT_INST_ID_ varchar(64), |
| 45 | IS_ACTIVE_ TINYINT, |
| 46 | IS_CONCURRENT_ TINYINT, |
| 47 | IS_SCOPE_ TINYINT, |
| 48 | IS_EVENT_SCOPE_ TINYINT, |
| 49 | SUSPENSION_STATE_ integer, |
| 50 | CACHED_ENT_STATE_ integer, |
| 51 | SEQUENCE_COUNTER_ bigint, |
| 52 | TENANT_ID_ varchar(64), |
| 53 | primary key (ID_) |
| 54 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 55 | |
| 56 | create table ACT_RU_JOB ( |
| 57 | ID_ varchar(64) NOT NULL, |
| 58 | REV_ integer, |
| 59 | TYPE_ varchar(255) NOT NULL, |
| 60 | LOCK_EXP_TIME_ timestamp(3) NULL, |
| 61 | LOCK_OWNER_ varchar(255), |
| 62 | EXCLUSIVE_ boolean, |
| 63 | EXECUTION_ID_ varchar(64), |
| 64 | PROCESS_INSTANCE_ID_ varchar(64), |
| 65 | PROCESS_DEF_ID_ varchar(64), |
| 66 | PROCESS_DEF_KEY_ varchar(255), |
| 67 | RETRIES_ integer, |
| 68 | EXCEPTION_STACK_ID_ varchar(64), |
| 69 | EXCEPTION_MSG_ varchar(4000), |
| 70 | DUEDATE_ timestamp(3) NULL, |
| 71 | REPEAT_ varchar(255), |
| 72 | HANDLER_TYPE_ varchar(255), |
| 73 | HANDLER_CFG_ varchar(4000), |
| 74 | DEPLOYMENT_ID_ varchar(64), |
| 75 | SUSPENSION_STATE_ integer NOT NULL DEFAULT 1, |
| 76 | JOB_DEF_ID_ varchar(64), |
| 77 | PRIORITY_ bigint NOT NULL DEFAULT 0, |
| 78 | SEQUENCE_COUNTER_ bigint, |
| 79 | TENANT_ID_ varchar(64), |
| 80 | primary key (ID_) |
| 81 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 82 | |
| 83 | create table ACT_RU_JOBDEF ( |
| 84 | ID_ varchar(64) NOT NULL, |
| 85 | REV_ integer, |
| 86 | PROC_DEF_ID_ varchar(64), |
| 87 | PROC_DEF_KEY_ varchar(255), |
| 88 | ACT_ID_ varchar(255), |
| 89 | JOB_TYPE_ varchar(255) NOT NULL, |
| 90 | JOB_CONFIGURATION_ varchar(255), |
| 91 | SUSPENSION_STATE_ integer, |
| 92 | JOB_PRIORITY_ bigint, |
| 93 | TENANT_ID_ varchar(64), |
| 94 | primary key (ID_) |
| 95 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 96 | |
| 97 | create table ACT_RE_PROCDEF ( |
| 98 | ID_ varchar(64) not null, |
| 99 | REV_ integer, |
| 100 | CATEGORY_ varchar(255), |
| 101 | NAME_ varchar(255), |
| 102 | KEY_ varchar(255) not null, |
| 103 | VERSION_ integer not null, |
| 104 | DEPLOYMENT_ID_ varchar(64), |
| 105 | RESOURCE_NAME_ varchar(4000), |
| 106 | DGRM_RESOURCE_NAME_ varchar(4000), |
| 107 | HAS_START_FORM_KEY_ TINYINT, |
| 108 | SUSPENSION_STATE_ integer, |
| 109 | TENANT_ID_ varchar(64), |
| 110 | VERSION_TAG_ varchar(64), |
| 111 | HISTORY_TTL_ integer, |
| 112 | primary key (ID_) |
| 113 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 114 | |
| 115 | create table ACT_RU_TASK ( |
| 116 | ID_ varchar(64), |
| 117 | REV_ integer, |
| 118 | EXECUTION_ID_ varchar(64), |
| 119 | PROC_INST_ID_ varchar(64), |
| 120 | PROC_DEF_ID_ varchar(64), |
| 121 | CASE_EXECUTION_ID_ varchar(64), |
| 122 | CASE_INST_ID_ varchar(64), |
| 123 | CASE_DEF_ID_ varchar(64), |
| 124 | NAME_ varchar(255), |
| 125 | PARENT_TASK_ID_ varchar(64), |
| 126 | DESCRIPTION_ varchar(4000), |
| 127 | TASK_DEF_KEY_ varchar(255), |
| 128 | OWNER_ varchar(255), |
| 129 | ASSIGNEE_ varchar(255), |
| 130 | DELEGATION_ varchar(64), |
| 131 | PRIORITY_ integer, |
| 132 | CREATE_TIME_ timestamp(3), |
| 133 | DUE_DATE_ datetime(3), |
| 134 | FOLLOW_UP_DATE_ datetime(3), |
| 135 | SUSPENSION_STATE_ integer, |
| 136 | TENANT_ID_ varchar(64), |
| 137 | primary key (ID_) |
| 138 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 139 | |
| 140 | create table ACT_RU_IDENTITYLINK ( |
| 141 | ID_ varchar(64), |
| 142 | REV_ integer, |
| 143 | GROUP_ID_ varchar(255), |
| 144 | TYPE_ varchar(255), |
| 145 | USER_ID_ varchar(255), |
| 146 | TASK_ID_ varchar(64), |
| 147 | PROC_DEF_ID_ varchar(64), |
| 148 | TENANT_ID_ varchar(64), |
| 149 | primary key (ID_) |
| 150 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 151 | |
| 152 | create table ACT_RU_VARIABLE ( |
| 153 | ID_ varchar(64) not null, |
| 154 | REV_ integer, |
| 155 | TYPE_ varchar(255) not null, |
| 156 | NAME_ varchar(255) not null, |
| 157 | EXECUTION_ID_ varchar(64), |
| 158 | PROC_INST_ID_ varchar(64), |
| 159 | CASE_EXECUTION_ID_ varchar(64), |
| 160 | CASE_INST_ID_ varchar(64), |
| 161 | TASK_ID_ varchar(64), |
| 162 | BYTEARRAY_ID_ varchar(64), |
| 163 | DOUBLE_ double, |
| 164 | LONG_ bigint, |
| 165 | TEXT_ LONGBLOB, |
| 166 | TEXT2_ LONGBLOB, |
| 167 | VAR_SCOPE_ varchar(64) not null, |
| 168 | SEQUENCE_COUNTER_ bigint, |
| 169 | IS_CONCURRENT_LOCAL_ TINYINT, |
| 170 | TENANT_ID_ varchar(64), |
| 171 | primary key (ID_) |
| 172 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 173 | |
| 174 | create table ACT_RU_EVENT_SUBSCR ( |
| 175 | ID_ varchar(64) not null, |
| 176 | REV_ integer, |
| 177 | EVENT_TYPE_ varchar(255) not null, |
| 178 | EVENT_NAME_ varchar(255), |
| 179 | EXECUTION_ID_ varchar(64), |
| 180 | PROC_INST_ID_ varchar(64), |
| 181 | ACTIVITY_ID_ varchar(255), |
| 182 | CONFIGURATION_ varchar(255), |
| 183 | CREATED_ timestamp(3) not null, |
| 184 | TENANT_ID_ varchar(64), |
| 185 | primary key (ID_) |
| 186 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 187 | |
| 188 | create table ACT_RU_INCIDENT ( |
| 189 | ID_ varchar(64) not null, |
| 190 | REV_ integer not null, |
| 191 | INCIDENT_TIMESTAMP_ timestamp(3) not null, |
| 192 | INCIDENT_MSG_ varchar(4000), |
| 193 | INCIDENT_TYPE_ varchar(255) not null, |
| 194 | EXECUTION_ID_ varchar(64), |
| 195 | ACTIVITY_ID_ varchar(255), |
| 196 | PROC_INST_ID_ varchar(64), |
| 197 | PROC_DEF_ID_ varchar(64), |
| 198 | CAUSE_INCIDENT_ID_ varchar(64), |
| 199 | ROOT_CAUSE_INCIDENT_ID_ varchar(64), |
| 200 | CONFIGURATION_ varchar(255), |
| 201 | TENANT_ID_ varchar(64), |
| 202 | JOB_DEF_ID_ varchar(64), |
| 203 | primary key (ID_) |
| 204 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 205 | |
| 206 | create table ACT_RU_AUTHORIZATION ( |
| 207 | ID_ varchar(64) not null, |
| 208 | REV_ integer not null, |
| 209 | TYPE_ integer not null, |
| 210 | GROUP_ID_ varchar(255), |
| 211 | USER_ID_ varchar(255), |
| 212 | RESOURCE_TYPE_ integer not null, |
| 213 | RESOURCE_ID_ varchar(255), |
| 214 | PERMS_ integer, |
| 215 | primary key (ID_) |
| 216 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 217 | |
| 218 | create table ACT_RU_FILTER ( |
| 219 | ID_ varchar(64) not null, |
| 220 | REV_ integer not null, |
| 221 | RESOURCE_TYPE_ varchar(255) not null, |
| 222 | NAME_ varchar(255) not null, |
| 223 | OWNER_ varchar(255), |
| 224 | QUERY_ LONGTEXT not null, |
| 225 | PROPERTIES_ LONGTEXT, |
| 226 | primary key (ID_) |
| 227 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 228 | |
| 229 | create table ACT_RU_METER_LOG ( |
| 230 | ID_ varchar(64) not null, |
| 231 | NAME_ varchar(64) not null, |
| 232 | REPORTER_ varchar(255), |
| 233 | VALUE_ bigint, |
| 234 | TIMESTAMP_ timestamp(3), |
| 235 | MILLISECONDS_ bigint DEFAULT 0, |
| 236 | primary key (ID_) |
| 237 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 238 | |
| 239 | create table ACT_RU_EXT_TASK ( |
| 240 | ID_ varchar(64) not null, |
| 241 | REV_ integer not null, |
| 242 | WORKER_ID_ varchar(255), |
| 243 | TOPIC_NAME_ varchar(255), |
| 244 | RETRIES_ integer, |
| 245 | ERROR_MSG_ varchar(4000), |
| 246 | ERROR_DETAILS_ID_ varchar(64), |
| 247 | LOCK_EXP_TIME_ timestamp(3) NULL, |
| 248 | SUSPENSION_STATE_ integer, |
| 249 | EXECUTION_ID_ varchar(64), |
| 250 | PROC_INST_ID_ varchar(64), |
| 251 | PROC_DEF_ID_ varchar(64), |
| 252 | PROC_DEF_KEY_ varchar(255), |
| 253 | ACT_ID_ varchar(255), |
| 254 | ACT_INST_ID_ varchar(64), |
| 255 | TENANT_ID_ varchar(64), |
| 256 | PRIORITY_ bigint NOT NULL DEFAULT 0, |
| 257 | primary key (ID_) |
| 258 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 259 | |
| 260 | create table ACT_RU_BATCH ( |
| 261 | ID_ varchar(64) not null, |
| 262 | REV_ integer not null, |
| 263 | TYPE_ varchar(255), |
| 264 | TOTAL_JOBS_ integer, |
| 265 | JOBS_CREATED_ integer, |
| 266 | JOBS_PER_SEED_ integer, |
| 267 | INVOCATIONS_PER_JOB_ integer, |
| 268 | SEED_JOB_DEF_ID_ varchar(64), |
| 269 | BATCH_JOB_DEF_ID_ varchar(64), |
| 270 | MONITOR_JOB_DEF_ID_ varchar(64), |
| 271 | SUSPENSION_STATE_ integer, |
| 272 | CONFIGURATION_ varchar(255), |
| 273 | TENANT_ID_ varchar(64), |
| 274 | primary key (ID_) |
| 275 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 276 | |
| 277 | create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); |
| 278 | create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); |
| 279 | create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_); |
| 280 | create index ACT_IDX_TASK_ASSIGNEE on ACT_RU_TASK(ASSIGNEE_); |
| 281 | create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); |
| 282 | create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); |
| 283 | create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_); |
| 284 | create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_); |
| 285 | create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); |
| 286 | create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); |
| 287 | create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); |
| 288 | create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); |
| 289 | create index ACT_IDX_INC_CONFIGURATION on ACT_RU_INCIDENT(CONFIGURATION_); |
| 290 | create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); |
| 291 | -- CAM-5914 |
| 292 | create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_); |
| 293 | -- this index needs to be limited in mariadb see CAM-6938 |
| 294 | create index ACT_IDX_JOB_HANDLER on ACT_RU_JOB(HANDLER_TYPE_(100),HANDLER_CFG_(155)); |
| 295 | create index ACT_IDX_JOB_PROCINST on ACT_RU_JOB(PROCESS_INSTANCE_ID_); |
| 296 | create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); |
| 297 | create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); |
| 298 | |
| 299 | -- new metric milliseconds column |
| 300 | CREATE INDEX ACT_IDX_METER_LOG_MS ON ACT_RU_METER_LOG(MILLISECONDS_); |
| 301 | CREATE INDEX ACT_IDX_METER_LOG_NAME_MS ON ACT_RU_METER_LOG(NAME_, MILLISECONDS_); |
| 302 | CREATE INDEX ACT_IDX_METER_LOG_REPORT ON ACT_RU_METER_LOG(NAME_, REPORTER_, MILLISECONDS_); |
| 303 | |
| 304 | -- old metric timestamp column |
| 305 | CREATE INDEX ACT_IDX_METER_LOG_TIME ON ACT_RU_METER_LOG(TIMESTAMP_); |
| 306 | CREATE INDEX ACT_IDX_METER_LOG ON ACT_RU_METER_LOG(NAME_, TIMESTAMP_); |
| 307 | |
| 308 | create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); |
| 309 | create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); |
| 310 | create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); |
| 311 | create index ACT_IDX_EXT_TASK_ERR_DETAILS ON ACT_RU_EXT_TASK(ERROR_DETAILS_ID_); |
| 312 | create index ACT_IDX_AUTH_GROUP_ID ON ACT_RU_AUTHORIZATION(GROUP_ID_); |
| 313 | create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); |
| 314 | |
| 315 | alter table ACT_GE_BYTEARRAY |
| 316 | add constraint ACT_FK_BYTEARR_DEPL |
| 317 | foreign key (DEPLOYMENT_ID_) |
| 318 | references ACT_RE_DEPLOYMENT (ID_); |
| 319 | |
| 320 | alter table ACT_RU_EXECUTION |
| 321 | add constraint ACT_FK_EXE_PROCINST |
| 322 | foreign key (PROC_INST_ID_) |
| 323 | references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade; |
| 324 | |
| 325 | alter table ACT_RU_EXECUTION |
| 326 | add constraint ACT_FK_EXE_PARENT |
| 327 | foreign key (PARENT_ID_) |
| 328 | references ACT_RU_EXECUTION (ID_); |
| 329 | |
| 330 | alter table ACT_RU_EXECUTION |
| 331 | add constraint ACT_FK_EXE_SUPER |
| 332 | foreign key (SUPER_EXEC_) |
| 333 | references ACT_RU_EXECUTION (ID_); |
| 334 | |
| 335 | alter table ACT_RU_EXECUTION |
| 336 | add constraint ACT_FK_EXE_PROCDEF |
| 337 | foreign key (PROC_DEF_ID_) |
| 338 | references ACT_RE_PROCDEF (ID_); |
| 339 | |
| 340 | alter table ACT_RU_IDENTITYLINK |
| 341 | add constraint ACT_FK_TSKASS_TASK |
| 342 | foreign key (TASK_ID_) |
| 343 | references ACT_RU_TASK (ID_); |
| 344 | |
| 345 | alter table ACT_RU_IDENTITYLINK |
| 346 | add constraint ACT_FK_ATHRZ_PROCEDEF |
| 347 | foreign key (PROC_DEF_ID_) |
| 348 | references ACT_RE_PROCDEF(ID_); |
| 349 | |
| 350 | alter table ACT_RU_TASK |
| 351 | add constraint ACT_FK_TASK_EXE |
| 352 | foreign key (EXECUTION_ID_) |
| 353 | references ACT_RU_EXECUTION (ID_); |
| 354 | |
| 355 | alter table ACT_RU_TASK |
| 356 | add constraint ACT_FK_TASK_PROCINST |
| 357 | foreign key (PROC_INST_ID_) |
| 358 | references ACT_RU_EXECUTION (ID_); |
| 359 | |
| 360 | alter table ACT_RU_TASK |
| 361 | add constraint ACT_FK_TASK_PROCDEF |
| 362 | foreign key (PROC_DEF_ID_) |
| 363 | references ACT_RE_PROCDEF (ID_); |
| 364 | |
| 365 | alter table ACT_RU_VARIABLE |
| 366 | add constraint ACT_FK_VAR_EXE |
| 367 | foreign key (EXECUTION_ID_) |
| 368 | references ACT_RU_EXECUTION (ID_); |
| 369 | |
| 370 | alter table ACT_RU_VARIABLE |
| 371 | add constraint ACT_FK_VAR_PROCINST |
| 372 | foreign key (PROC_INST_ID_) |
| 373 | references ACT_RU_EXECUTION(ID_); |
| 374 | |
| 375 | alter table ACT_RU_VARIABLE |
| 376 | add constraint ACT_FK_VAR_BYTEARRAY |
| 377 | foreign key (BYTEARRAY_ID_) |
| 378 | references ACT_GE_BYTEARRAY (ID_); |
| 379 | |
| 380 | alter table ACT_RU_JOB |
| 381 | add constraint ACT_FK_JOB_EXCEPTION |
| 382 | foreign key (EXCEPTION_STACK_ID_) |
| 383 | references ACT_GE_BYTEARRAY (ID_); |
| 384 | |
| 385 | alter table ACT_RU_EVENT_SUBSCR |
| 386 | add constraint ACT_FK_EVENT_EXEC |
| 387 | foreign key (EXECUTION_ID_) |
| 388 | references ACT_RU_EXECUTION(ID_); |
| 389 | |
| 390 | alter table ACT_RU_INCIDENT |
| 391 | add constraint ACT_FK_INC_EXE |
| 392 | foreign key (EXECUTION_ID_) |
| 393 | references ACT_RU_EXECUTION (ID_); |
| 394 | |
| 395 | alter table ACT_RU_INCIDENT |
| 396 | add constraint ACT_FK_INC_PROCINST |
| 397 | foreign key (PROC_INST_ID_) |
| 398 | references ACT_RU_EXECUTION (ID_); |
| 399 | |
| 400 | alter table ACT_RU_INCIDENT |
| 401 | add constraint ACT_FK_INC_PROCDEF |
| 402 | foreign key (PROC_DEF_ID_) |
| 403 | references ACT_RE_PROCDEF (ID_); |
| 404 | |
| 405 | alter table ACT_RU_INCIDENT |
| 406 | add constraint ACT_FK_INC_CAUSE |
| 407 | foreign key (CAUSE_INCIDENT_ID_) |
| 408 | references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; |
| 409 | |
| 410 | alter table ACT_RU_INCIDENT |
| 411 | add constraint ACT_FK_INC_RCAUSE |
| 412 | foreign key (ROOT_CAUSE_INCIDENT_ID_) |
| 413 | references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; |
| 414 | |
| 415 | alter table ACT_RU_EXT_TASK |
| 416 | add constraint ACT_FK_EXT_TASK_ERROR_DETAILS |
| 417 | foreign key (ERROR_DETAILS_ID_) |
| 418 | references ACT_GE_BYTEARRAY (ID_); |
| 419 | |
| 420 | create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); |
| 421 | alter table ACT_RU_INCIDENT |
| 422 | add constraint ACT_FK_INC_JOB_DEF |
| 423 | foreign key (JOB_DEF_ID_) |
| 424 | references ACT_RU_JOBDEF (ID_); |
| 425 | |
| 426 | alter table ACT_RU_AUTHORIZATION |
| 427 | add constraint ACT_UNIQ_AUTH_USER |
| 428 | unique (USER_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); |
| 429 | |
| 430 | alter table ACT_RU_AUTHORIZATION |
| 431 | add constraint ACT_UNIQ_AUTH_GROUP |
| 432 | unique (GROUP_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); |
| 433 | |
| 434 | alter table ACT_RU_VARIABLE |
| 435 | add constraint ACT_UNIQ_VARIABLE |
| 436 | unique (VAR_SCOPE_, NAME_); |
| 437 | |
| 438 | alter table ACT_RU_EXT_TASK |
| 439 | add constraint ACT_FK_EXT_TASK_EXE |
| 440 | foreign key (EXECUTION_ID_) |
| 441 | references ACT_RU_EXECUTION (ID_); |
| 442 | |
| 443 | create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); |
| 444 | alter table ACT_RU_BATCH |
| 445 | add constraint ACT_FK_BATCH_SEED_JOB_DEF |
| 446 | foreign key (SEED_JOB_DEF_ID_) |
| 447 | references ACT_RU_JOBDEF (ID_); |
| 448 | |
| 449 | create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); |
| 450 | alter table ACT_RU_BATCH |
| 451 | add constraint ACT_FK_BATCH_MONITOR_JOB_DEF |
| 452 | foreign key (MONITOR_JOB_DEF_ID_) |
| 453 | references ACT_RU_JOBDEF (ID_); |
| 454 | |
| 455 | create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); |
| 456 | alter table ACT_RU_BATCH |
| 457 | add constraint ACT_FK_BATCH_JOB_DEF |
| 458 | foreign key (BATCH_JOB_DEF_ID_) |
| 459 | references ACT_RU_JOBDEF (ID_); |
| 460 | |
| 461 | -- indexes for deadlock problems - https://app.camunda.com/jira/browse/CAM-2567 -- |
| 462 | create index ACT_IDX_INC_CAUSEINCID on ACT_RU_INCIDENT(CAUSE_INCIDENT_ID_); |
| 463 | create index ACT_IDX_INC_EXID on ACT_RU_INCIDENT(EXECUTION_ID_); |
| 464 | create index ACT_IDX_INC_PROCDEFID on ACT_RU_INCIDENT(PROC_DEF_ID_); |
| 465 | create index ACT_IDX_INC_PROCINSTID on ACT_RU_INCIDENT(PROC_INST_ID_); |
| 466 | create index ACT_IDX_INC_ROOTCAUSEINCID on ACT_RU_INCIDENT(ROOT_CAUSE_INCIDENT_ID_); |
| 467 | -- index for deadlock problem - https://app.camunda.com/jira/browse/CAM-4440 -- |
| 468 | create index ACT_IDX_AUTH_RESOURCE_ID on ACT_RU_AUTHORIZATION(RESOURCE_ID_); |
| 469 | -- index to prevent deadlock on fk constraint - https://app.camunda.com/jira/browse/CAM-5440 -- |
| 470 | create index ACT_IDX_EXT_TASK_EXEC on ACT_RU_EXT_TASK(EXECUTION_ID_); |
| 471 | |
| 472 | -- indexes to improve deployment |
| 473 | create index ACT_IDX_BYTEARRAY_NAME on ACT_GE_BYTEARRAY(NAME_); |
| 474 | create index ACT_IDX_DEPLOYMENT_NAME on ACT_RE_DEPLOYMENT(NAME_); |
| 475 | create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); |
| 476 | create index ACT_IDX_JOBDEF_PROC_DEF_ID ON ACT_RU_JOBDEF(PROC_DEF_ID_); |
| 477 | create index ACT_IDX_JOB_HANDLER_TYPE ON ACT_RU_JOB(HANDLER_TYPE_); |
| 478 | create index ACT_IDX_EVENT_SUBSCR_EVT_NAME ON ACT_RU_EVENT_SUBSCR(EVENT_NAME_); |
| 479 | create index ACT_IDX_PROCDEF_DEPLOYMENT_ID ON ACT_RE_PROCDEF(DEPLOYMENT_ID_); |
| 480 | create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); |
| 481 | create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); |
| 482 | -- create case definition table -- |
| 483 | create table ACT_RE_CASE_DEF ( |
| 484 | ID_ varchar(64) not null, |
| 485 | REV_ integer, |
| 486 | CATEGORY_ varchar(255), |
| 487 | NAME_ varchar(255), |
| 488 | KEY_ varchar(255) not null, |
| 489 | VERSION_ integer not null, |
| 490 | DEPLOYMENT_ID_ varchar(64), |
| 491 | RESOURCE_NAME_ varchar(4000), |
| 492 | DGRM_RESOURCE_NAME_ varchar(4000), |
| 493 | TENANT_ID_ varchar(64), |
| 494 | HISTORY_TTL_ integer, |
| 495 | primary key (ID_) |
| 496 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 497 | |
| 498 | -- create case execution table -- |
| 499 | create table ACT_RU_CASE_EXECUTION ( |
| 500 | ID_ varchar(64) NOT NULL, |
| 501 | REV_ integer, |
| 502 | CASE_INST_ID_ varchar(64), |
| 503 | SUPER_CASE_EXEC_ varchar(64), |
| 504 | SUPER_EXEC_ varchar(64), |
| 505 | BUSINESS_KEY_ varchar(255), |
| 506 | PARENT_ID_ varchar(64), |
| 507 | CASE_DEF_ID_ varchar(64), |
| 508 | ACT_ID_ varchar(255), |
| 509 | PREV_STATE_ integer, |
| 510 | CURRENT_STATE_ integer, |
| 511 | REQUIRED_ boolean, |
| 512 | TENANT_ID_ varchar(64), |
| 513 | primary key (ID_) |
| 514 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 515 | |
| 516 | -- create case sentry part table -- |
| 517 | |
| 518 | create table ACT_RU_CASE_SENTRY_PART ( |
| 519 | ID_ varchar(64) NOT NULL, |
| 520 | REV_ integer, |
| 521 | CASE_INST_ID_ varchar(64), |
| 522 | CASE_EXEC_ID_ varchar(64), |
| 523 | SENTRY_ID_ varchar(255), |
| 524 | TYPE_ varchar(255), |
| 525 | SOURCE_CASE_EXEC_ID_ varchar(64), |
| 526 | STANDARD_EVENT_ varchar(255), |
| 527 | SOURCE_ varchar(255), |
| 528 | VARIABLE_EVENT_ varchar(255), |
| 529 | VARIABLE_NAME_ varchar(255), |
| 530 | SATISFIED_ boolean, |
| 531 | TENANT_ID_ varchar(64), |
| 532 | primary key (ID_) |
| 533 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 534 | |
| 535 | -- create index on business key -- |
| 536 | create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_); |
| 537 | |
| 538 | -- create foreign key constraints on ACT_RU_CASE_EXECUTION -- |
| 539 | alter table ACT_RU_CASE_EXECUTION |
| 540 | add constraint ACT_FK_CASE_EXE_CASE_INST |
| 541 | foreign key (CASE_INST_ID_) |
| 542 | references ACT_RU_CASE_EXECUTION(ID_) on delete cascade on update cascade; |
| 543 | |
| 544 | alter table ACT_RU_CASE_EXECUTION |
| 545 | add constraint ACT_FK_CASE_EXE_PARENT |
| 546 | foreign key (PARENT_ID_) |
| 547 | references ACT_RU_CASE_EXECUTION(ID_); |
| 548 | |
| 549 | alter table ACT_RU_CASE_EXECUTION |
| 550 | add constraint ACT_FK_CASE_EXE_CASE_DEF |
| 551 | foreign key (CASE_DEF_ID_) |
| 552 | references ACT_RE_CASE_DEF(ID_); |
| 553 | |
| 554 | -- create foreign key constraints on ACT_RU_VARIABLE -- |
| 555 | alter table ACT_RU_VARIABLE |
| 556 | add constraint ACT_FK_VAR_CASE_EXE |
| 557 | foreign key (CASE_EXECUTION_ID_) |
| 558 | references ACT_RU_CASE_EXECUTION(ID_); |
| 559 | |
| 560 | alter table ACT_RU_VARIABLE |
| 561 | add constraint ACT_FK_VAR_CASE_INST |
| 562 | foreign key (CASE_INST_ID_) |
| 563 | references ACT_RU_CASE_EXECUTION(ID_); |
| 564 | |
| 565 | -- create foreign key constraints on ACT_RU_TASK -- |
| 566 | alter table ACT_RU_TASK |
| 567 | add constraint ACT_FK_TASK_CASE_EXE |
| 568 | foreign key (CASE_EXECUTION_ID_) |
| 569 | references ACT_RU_CASE_EXECUTION(ID_); |
| 570 | |
| 571 | alter table ACT_RU_TASK |
| 572 | add constraint ACT_FK_TASK_CASE_DEF |
| 573 | foreign key (CASE_DEF_ID_) |
| 574 | references ACT_RE_CASE_DEF(ID_); |
| 575 | |
| 576 | -- create foreign key constraints on ACT_RU_CASE_SENTRY_PART -- |
| 577 | alter table ACT_RU_CASE_SENTRY_PART |
| 578 | add constraint ACT_FK_CASE_SENTRY_CASE_INST |
| 579 | foreign key (CASE_INST_ID_) |
| 580 | references ACT_RU_CASE_EXECUTION(ID_); |
| 581 | |
| 582 | alter table ACT_RU_CASE_SENTRY_PART |
| 583 | add constraint ACT_FK_CASE_SENTRY_CASE_EXEC |
| 584 | foreign key (CASE_EXEC_ID_) |
| 585 | references ACT_RU_CASE_EXECUTION(ID_); |
| 586 | |
| 587 | create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); |
| 588 | create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); |
| 589 | -- create decision definition table -- |
| 590 | create table ACT_RE_DECISION_DEF ( |
| 591 | ID_ varchar(64) not null, |
| 592 | REV_ integer, |
| 593 | CATEGORY_ varchar(255), |
| 594 | NAME_ varchar(255), |
| 595 | KEY_ varchar(255) not null, |
| 596 | VERSION_ integer not null, |
| 597 | DEPLOYMENT_ID_ varchar(64), |
| 598 | RESOURCE_NAME_ varchar(4000), |
| 599 | DGRM_RESOURCE_NAME_ varchar(4000), |
| 600 | DEC_REQ_ID_ varchar(64), |
| 601 | DEC_REQ_KEY_ varchar(255), |
| 602 | TENANT_ID_ varchar(64), |
| 603 | HISTORY_TTL_ integer, |
| 604 | VERSION_TAG_ varchar(64), |
| 605 | primary key (ID_) |
| 606 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 607 | |
| 608 | -- create decision requirements definition table -- |
| 609 | create table ACT_RE_DECISION_REQ_DEF ( |
| 610 | ID_ varchar(64) NOT NULL, |
| 611 | REV_ integer, |
| 612 | CATEGORY_ varchar(255), |
| 613 | NAME_ varchar(255), |
| 614 | KEY_ varchar(255) NOT NULL, |
| 615 | VERSION_ integer NOT NULL, |
| 616 | DEPLOYMENT_ID_ varchar(64), |
| 617 | RESOURCE_NAME_ varchar(4000), |
| 618 | DGRM_RESOURCE_NAME_ varchar(4000), |
| 619 | TENANT_ID_ varchar(64), |
| 620 | primary key (ID_) |
| 621 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 622 | |
| 623 | alter table ACT_RE_DECISION_DEF |
| 624 | add constraint ACT_FK_DEC_REQ |
| 625 | foreign key (DEC_REQ_ID_) |
| 626 | references ACT_RE_DECISION_REQ_DEF(ID_); |
| 627 | |
| 628 | create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); |
| 629 | create index ACT_IDX_DEC_DEF_REQ_ID on ACT_RE_DECISION_DEF(DEC_REQ_ID_); |
| 630 | create index ACT_IDX_DEC_REQ_DEF_TENANT_ID on ACT_RE_DECISION_REQ_DEF(TENANT_ID_); |
| 631 | create table ACT_HI_PROCINST ( |
| 632 | ID_ varchar(64) not null, |
| 633 | PROC_INST_ID_ varchar(64) not null, |
| 634 | BUSINESS_KEY_ varchar(255), |
| 635 | PROC_DEF_KEY_ varchar(255), |
| 636 | PROC_DEF_ID_ varchar(64) not null, |
| 637 | START_TIME_ datetime(3) not null, |
| 638 | END_TIME_ datetime(3), |
| 639 | DURATION_ bigint, |
| 640 | START_USER_ID_ varchar(255), |
| 641 | START_ACT_ID_ varchar(255), |
| 642 | END_ACT_ID_ varchar(255), |
| 643 | SUPER_PROCESS_INSTANCE_ID_ varchar(64), |
| 644 | SUPER_CASE_INSTANCE_ID_ varchar(64), |
| 645 | CASE_INST_ID_ varchar(64), |
| 646 | DELETE_REASON_ varchar(4000), |
| 647 | TENANT_ID_ varchar(64), |
| 648 | STATE_ varchar(255), |
| 649 | primary key (ID_), |
| 650 | unique (PROC_INST_ID_) |
| 651 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 652 | |
| 653 | create table ACT_HI_ACTINST ( |
| 654 | ID_ varchar(64) not null, |
| 655 | PARENT_ACT_INST_ID_ varchar(64), |
| 656 | PROC_DEF_KEY_ varchar(255), |
| 657 | PROC_DEF_ID_ varchar(64) not null, |
| 658 | PROC_INST_ID_ varchar(64) not null, |
| 659 | EXECUTION_ID_ varchar(64) not null, |
| 660 | ACT_ID_ varchar(255) not null, |
| 661 | TASK_ID_ varchar(64), |
| 662 | CALL_PROC_INST_ID_ varchar(64), |
| 663 | CALL_CASE_INST_ID_ varchar(64), |
| 664 | ACT_NAME_ varchar(255), |
| 665 | ACT_TYPE_ varchar(255) not null, |
| 666 | ASSIGNEE_ varchar(64), |
| 667 | START_TIME_ datetime(3) not null, |
| 668 | END_TIME_ datetime(3), |
| 669 | DURATION_ bigint, |
| 670 | ACT_INST_STATE_ integer, |
| 671 | SEQUENCE_COUNTER_ bigint, |
| 672 | TENANT_ID_ varchar(64), |
| 673 | primary key (ID_) |
| 674 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 675 | |
| 676 | create table ACT_HI_TASKINST ( |
| 677 | ID_ varchar(64) not null, |
| 678 | TASK_DEF_KEY_ varchar(255), |
| 679 | PROC_DEF_KEY_ varchar(255), |
| 680 | PROC_DEF_ID_ varchar(64), |
| 681 | PROC_INST_ID_ varchar(64), |
| 682 | EXECUTION_ID_ varchar(64), |
| 683 | CASE_DEF_KEY_ varchar(255), |
| 684 | CASE_DEF_ID_ varchar(64), |
| 685 | CASE_INST_ID_ varchar(64), |
| 686 | CASE_EXECUTION_ID_ varchar(64), |
| 687 | ACT_INST_ID_ varchar(64), |
| 688 | NAME_ varchar(255), |
| 689 | PARENT_TASK_ID_ varchar(64), |
| 690 | DESCRIPTION_ varchar(4000), |
| 691 | OWNER_ varchar(255), |
| 692 | ASSIGNEE_ varchar(255), |
| 693 | START_TIME_ datetime(3) not null, |
| 694 | END_TIME_ datetime(3), |
| 695 | DURATION_ bigint, |
| 696 | DELETE_REASON_ varchar(4000), |
| 697 | PRIORITY_ integer, |
| 698 | DUE_DATE_ datetime(3), |
| 699 | FOLLOW_UP_DATE_ datetime(3), |
| 700 | TENANT_ID_ varchar(64), |
| 701 | primary key (ID_) |
| 702 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 703 | |
| 704 | create table ACT_HI_VARINST ( |
| 705 | ID_ varchar(64) not null, |
| 706 | PROC_DEF_KEY_ varchar(255), |
| 707 | PROC_DEF_ID_ varchar(64), |
| 708 | PROC_INST_ID_ varchar(64), |
| 709 | EXECUTION_ID_ varchar(64), |
| 710 | ACT_INST_ID_ varchar(64), |
| 711 | CASE_DEF_KEY_ varchar(255), |
| 712 | CASE_DEF_ID_ varchar(64), |
| 713 | CASE_INST_ID_ varchar(64), |
| 714 | CASE_EXECUTION_ID_ varchar(64), |
| 715 | TASK_ID_ varchar(64), |
| 716 | NAME_ varchar(255) not null, |
| 717 | VAR_TYPE_ varchar(100), |
| 718 | REV_ integer, |
| 719 | BYTEARRAY_ID_ varchar(64), |
| 720 | DOUBLE_ double, |
| 721 | LONG_ bigint, |
| 722 | TEXT_ LONGBLOB, |
| 723 | TEXT2_ LONGBLOB, |
| 724 | TENANT_ID_ varchar(64), |
| 725 | STATE_ varchar(20), |
| 726 | primary key (ID_) |
| 727 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 728 | |
| 729 | create table ACT_HI_DETAIL ( |
| 730 | ID_ varchar(64) not null, |
| 731 | TYPE_ varchar(255) not null, |
| 732 | PROC_DEF_KEY_ varchar(255), |
| 733 | PROC_DEF_ID_ varchar(64), |
| 734 | PROC_INST_ID_ varchar(64), |
| 735 | EXECUTION_ID_ varchar(64), |
| 736 | CASE_DEF_KEY_ varchar(255), |
| 737 | CASE_DEF_ID_ varchar(64), |
| 738 | CASE_INST_ID_ varchar(64), |
| 739 | CASE_EXECUTION_ID_ varchar(64), |
| 740 | TASK_ID_ varchar(64), |
| 741 | ACT_INST_ID_ varchar(64), |
| 742 | VAR_INST_ID_ varchar(64), |
| 743 | NAME_ varchar(255) not null, |
| 744 | VAR_TYPE_ varchar(255), |
| 745 | REV_ integer, |
| 746 | TIME_ datetime(3) not null, |
| 747 | BYTEARRAY_ID_ varchar(64), |
| 748 | DOUBLE_ double, |
| 749 | LONG_ bigint, |
| 750 | TEXT_ LONGBLOB, |
| 751 | TEXT2_ LONGBLOB, |
| 752 | SEQUENCE_COUNTER_ bigint, |
| 753 | TENANT_ID_ varchar(64), |
| 754 | OPERATION_ID_ varchar(64), |
| 755 | primary key (ID_) |
| 756 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 757 | |
| 758 | create table ACT_HI_IDENTITYLINK ( |
| 759 | ID_ varchar(64) not null, |
| 760 | TIMESTAMP_ timestamp(3) not null, |
| 761 | TYPE_ varchar(255), |
| 762 | USER_ID_ varchar(255), |
| 763 | GROUP_ID_ varchar(255), |
| 764 | TASK_ID_ varchar(64), |
| 765 | PROC_DEF_ID_ varchar(64), |
| 766 | OPERATION_TYPE_ varchar(64), |
| 767 | ASSIGNER_ID_ varchar(64), |
| 768 | PROC_DEF_KEY_ varchar(255), |
| 769 | TENANT_ID_ varchar(64), |
| 770 | primary key (ID_) |
| 771 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 772 | |
| 773 | create table ACT_HI_COMMENT ( |
| 774 | ID_ varchar(64) not null, |
| 775 | TYPE_ varchar(255), |
| 776 | TIME_ datetime(3) not null, |
| 777 | USER_ID_ varchar(255), |
| 778 | TASK_ID_ varchar(64), |
| 779 | PROC_INST_ID_ varchar(64), |
| 780 | ACTION_ varchar(255), |
| 781 | MESSAGE_ varchar(4000), |
| 782 | FULL_MSG_ LONGBLOB, |
| 783 | TENANT_ID_ varchar(64), |
| 784 | primary key (ID_) |
| 785 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 786 | |
| 787 | create table ACT_HI_ATTACHMENT ( |
| 788 | ID_ varchar(64) not null, |
| 789 | REV_ integer, |
| 790 | USER_ID_ varchar(255), |
| 791 | NAME_ varchar(255), |
| 792 | DESCRIPTION_ varchar(4000), |
| 793 | TYPE_ varchar(255), |
| 794 | TASK_ID_ varchar(64), |
| 795 | PROC_INST_ID_ varchar(64), |
| 796 | URL_ varchar(4000), |
| 797 | CONTENT_ID_ varchar(64), |
| 798 | TENANT_ID_ varchar(64), |
| 799 | primary key (ID_) |
| 800 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 801 | |
| 802 | create table ACT_HI_OP_LOG ( |
| 803 | ID_ varchar(64) not null, |
| 804 | DEPLOYMENT_ID_ varchar(64), |
| 805 | PROC_DEF_ID_ varchar(64), |
| 806 | PROC_DEF_KEY_ varchar(255), |
| 807 | PROC_INST_ID_ varchar(64), |
| 808 | EXECUTION_ID_ varchar(64), |
| 809 | CASE_DEF_ID_ varchar(64), |
| 810 | CASE_INST_ID_ varchar(64), |
| 811 | CASE_EXECUTION_ID_ varchar(64), |
| 812 | TASK_ID_ varchar(64), |
| 813 | JOB_ID_ varchar(64), |
| 814 | JOB_DEF_ID_ varchar(64), |
| 815 | BATCH_ID_ varchar(64), |
| 816 | USER_ID_ varchar(255), |
| 817 | TIMESTAMP_ timestamp(3) not null, |
| 818 | OPERATION_TYPE_ varchar(64), |
| 819 | OPERATION_ID_ varchar(64), |
| 820 | ENTITY_TYPE_ varchar(30), |
| 821 | PROPERTY_ varchar(64), |
| 822 | ORG_VALUE_ varchar(4000), |
| 823 | NEW_VALUE_ varchar(4000), |
| 824 | TENANT_ID_ varchar(64), |
| 825 | primary key (ID_) |
| 826 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 827 | |
| 828 | create table ACT_HI_INCIDENT ( |
| 829 | ID_ varchar(64) not null, |
| 830 | PROC_DEF_KEY_ varchar(255), |
| 831 | PROC_DEF_ID_ varchar(64), |
| 832 | PROC_INST_ID_ varchar(64), |
| 833 | EXECUTION_ID_ varchar(64), |
| 834 | CREATE_TIME_ timestamp(3) not null, |
| 835 | END_TIME_ timestamp(3) null, |
| 836 | INCIDENT_MSG_ varchar(4000), |
| 837 | INCIDENT_TYPE_ varchar(255) not null, |
| 838 | ACTIVITY_ID_ varchar(255), |
| 839 | CAUSE_INCIDENT_ID_ varchar(64), |
| 840 | ROOT_CAUSE_INCIDENT_ID_ varchar(64), |
| 841 | CONFIGURATION_ varchar(255), |
| 842 | INCIDENT_STATE_ integer, |
| 843 | TENANT_ID_ varchar(64), |
| 844 | JOB_DEF_ID_ varchar(64), |
| 845 | primary key (ID_) |
| 846 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 847 | |
| 848 | create table ACT_HI_JOB_LOG ( |
| 849 | ID_ varchar(64) not null, |
| 850 | TIMESTAMP_ timestamp(3) not null, |
| 851 | JOB_ID_ varchar(64) not null, |
| 852 | JOB_DUEDATE_ timestamp(3) NULL, |
| 853 | JOB_RETRIES_ integer, |
| 854 | JOB_PRIORITY_ bigint NOT NULL DEFAULT 0, |
| 855 | JOB_EXCEPTION_MSG_ varchar(4000), |
| 856 | JOB_EXCEPTION_STACK_ID_ varchar(64), |
| 857 | JOB_STATE_ integer, |
| 858 | JOB_DEF_ID_ varchar(64), |
| 859 | JOB_DEF_TYPE_ varchar(255), |
| 860 | JOB_DEF_CONFIGURATION_ varchar(255), |
| 861 | ACT_ID_ varchar(255), |
| 862 | EXECUTION_ID_ varchar(64), |
| 863 | PROCESS_INSTANCE_ID_ varchar(64), |
| 864 | PROCESS_DEF_ID_ varchar(64), |
| 865 | PROCESS_DEF_KEY_ varchar(255), |
| 866 | DEPLOYMENT_ID_ varchar(64), |
| 867 | SEQUENCE_COUNTER_ bigint, |
| 868 | TENANT_ID_ varchar(64), |
| 869 | primary key (ID_) |
| 870 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 871 | |
| 872 | create table ACT_HI_BATCH ( |
| 873 | ID_ varchar(64) not null, |
| 874 | TYPE_ varchar(255), |
| 875 | TOTAL_JOBS_ integer, |
| 876 | JOBS_PER_SEED_ integer, |
| 877 | INVOCATIONS_PER_JOB_ integer, |
| 878 | SEED_JOB_DEF_ID_ varchar(64), |
| 879 | MONITOR_JOB_DEF_ID_ varchar(64), |
| 880 | BATCH_JOB_DEF_ID_ varchar(64), |
| 881 | TENANT_ID_ varchar(64), |
| 882 | START_TIME_ datetime(3) not null, |
| 883 | END_TIME_ datetime(3), |
| 884 | primary key (ID_) |
| 885 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 886 | |
| 887 | create table ACT_HI_EXT_TASK_LOG ( |
| 888 | ID_ varchar(64) not null, |
| 889 | TIMESTAMP_ timestamp(3) not null, |
| 890 | EXT_TASK_ID_ varchar(64) not null, |
| 891 | RETRIES_ integer, |
| 892 | TOPIC_NAME_ varchar(255), |
| 893 | WORKER_ID_ varchar(255), |
| 894 | PRIORITY_ bigint NOT NULL DEFAULT 0, |
| 895 | ERROR_MSG_ varchar(4000), |
| 896 | ERROR_DETAILS_ID_ varchar(64), |
| 897 | ACT_ID_ varchar(255), |
| 898 | ACT_INST_ID_ varchar(64), |
| 899 | EXECUTION_ID_ varchar(64), |
| 900 | PROC_INST_ID_ varchar(64), |
| 901 | PROC_DEF_ID_ varchar(64), |
| 902 | PROC_DEF_KEY_ varchar(255), |
| 903 | TENANT_ID_ varchar(64), |
| 904 | STATE_ integer, |
| 905 | primary key (ID_) |
| 906 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 907 | |
| 908 | create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); |
| 909 | create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_); |
| 910 | create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); |
| 911 | create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); |
| 912 | |
| 913 | create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_); |
| 914 | create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_); |
| 915 | create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); |
| 916 | create index ACT_IDX_HI_ACT_INST_COMP on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_, END_TIME_, ID_); |
| 917 | create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_); |
| 918 | create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); |
| 919 | create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); |
| 920 | |
| 921 | create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); |
| 922 | create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); |
| 923 | create index ACT_IDX_HI_TASKINST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_); |
| 924 | create index ACT_IDX_HI_TASKINSTID_PROCINST on ACT_HI_TASKINST(ID_,PROC_INST_ID_); |
| 925 | |
| 926 | create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_); |
| 927 | create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_); |
| 928 | create index ACT_IDX_HI_DETAIL_CASE_INST on ACT_HI_DETAIL(CASE_INST_ID_); |
| 929 | create index ACT_IDX_HI_DETAIL_CASE_EXEC on ACT_HI_DETAIL(CASE_EXECUTION_ID_); |
| 930 | create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_); |
| 931 | create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_); |
| 932 | create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_); |
| 933 | create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); |
| 934 | create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); |
| 935 | create index ACT_IDX_HI_DETAIL_BYTEAR on ACT_HI_DETAIL(BYTEARRAY_ID_); |
| 936 | |
| 937 | create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); |
| 938 | create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); |
| 939 | create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); |
| 940 | create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); |
| 941 | create index ACT_IDX_HI_IDENT_LINK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_); |
| 942 | |
| 943 | create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_); |
| 944 | create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_); |
| 945 | create index ACT_IDX_HI_CASEVAR_CASE_INST on ACT_HI_VARINST(CASE_INST_ID_); |
| 946 | create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); |
| 947 | create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); |
| 948 | create index ACT_IDX_HI_VARINST_BYTEAR on ACT_HI_VARINST(BYTEARRAY_ID_); |
| 949 | |
| 950 | create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); |
| 951 | create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); |
| 952 | create index ACT_IDX_HI_INCIDENT_PROCINST on ACT_HI_INCIDENT(PROC_INST_ID_); |
| 953 | |
| 954 | create index ACT_IDX_HI_JOB_LOG_PROCINST on ACT_HI_JOB_LOG(PROCESS_INSTANCE_ID_); |
| 955 | create index ACT_IDX_HI_JOB_LOG_PROCDEF on ACT_HI_JOB_LOG(PROCESS_DEF_ID_); |
| 956 | create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); |
| 957 | create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); |
| 958 | create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); |
| 959 | create index ACT_IDX_HI_JOB_LOG_EX_STACK on ACT_HI_JOB_LOG(JOB_EXCEPTION_STACK_ID_); |
| 960 | |
| 961 | create index ACT_HI_EXT_TASK_LOG_PROCINST on ACT_HI_EXT_TASK_LOG(PROC_INST_ID_); |
| 962 | create index ACT_HI_EXT_TASK_LOG_PROCDEF on ACT_HI_EXT_TASK_LOG(PROC_DEF_ID_); |
| 963 | create index ACT_HI_EXT_TASK_LOG_PROC_DEF_KEY on ACT_HI_EXT_TASK_LOG(PROC_DEF_KEY_); |
| 964 | create index ACT_HI_EXT_TASK_LOG_TENANT_ID on ACT_HI_EXT_TASK_LOG(TENANT_ID_); |
| 965 | create index ACT_IDX_HI_EXTTASKLOG_ERRORDET on ACT_HI_EXT_TASK_LOG(ERROR_DETAILS_ID_); |
| 966 | |
| 967 | create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); |
| 968 | create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); |
| 969 | |
| 970 | create index ACT_IDX_HI_COMMENT_TASK on ACT_HI_COMMENT(TASK_ID_); |
| 971 | create index ACT_IDX_HI_COMMENT_PROCINST on ACT_HI_COMMENT(PROC_INST_ID_); |
| 972 | |
| 973 | create index ACT_IDX_HI_ATTACHMENT_CONTENT on ACT_HI_ATTACHMENT(CONTENT_ID_); |
| 974 | create index ACT_IDX_HI_ATTACHMENT_PROCINST on ACT_HI_ATTACHMENT(PROC_INST_ID_); |
| 975 | create index ACT_IDX_HI_ATTACHMENT_TASK on ACT_HI_ATTACHMENT(TASK_ID_); |
| 976 | create table ACT_HI_CASEINST ( |
| 977 | ID_ varchar(64) not null, |
| 978 | CASE_INST_ID_ varchar(64) not null, |
| 979 | BUSINESS_KEY_ varchar(255), |
| 980 | CASE_DEF_ID_ varchar(64) not null, |
| 981 | CREATE_TIME_ datetime(3) not null, |
| 982 | CLOSE_TIME_ datetime(3), |
| 983 | DURATION_ bigint, |
| 984 | STATE_ integer, |
| 985 | CREATE_USER_ID_ varchar(255), |
| 986 | SUPER_CASE_INSTANCE_ID_ varchar(64), |
| 987 | SUPER_PROCESS_INSTANCE_ID_ varchar(64), |
| 988 | TENANT_ID_ varchar(64), |
| 989 | primary key (ID_), |
| 990 | unique (CASE_INST_ID_) |
| 991 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 992 | |
| 993 | create table ACT_HI_CASEACTINST ( |
| 994 | ID_ varchar(64) not null, |
| 995 | PARENT_ACT_INST_ID_ varchar(64), |
| 996 | CASE_DEF_ID_ varchar(64) not null, |
| 997 | CASE_INST_ID_ varchar(64) not null, |
| 998 | CASE_ACT_ID_ varchar(255) not null, |
| 999 | TASK_ID_ varchar(64), |
| 1000 | CALL_PROC_INST_ID_ varchar(64), |
| 1001 | CALL_CASE_INST_ID_ varchar(64), |
| 1002 | CASE_ACT_NAME_ varchar(255), |
| 1003 | CASE_ACT_TYPE_ varchar(255), |
| 1004 | CREATE_TIME_ datetime(3) not null, |
| 1005 | END_TIME_ datetime(3), |
| 1006 | DURATION_ bigint, |
| 1007 | STATE_ integer, |
| 1008 | REQUIRED_ boolean, |
| 1009 | TENANT_ID_ varchar(64), |
| 1010 | primary key (ID_) |
| 1011 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 1012 | |
| 1013 | create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_); |
| 1014 | create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_); |
| 1015 | create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); |
| 1016 | create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_); |
| 1017 | create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_); |
| 1018 | create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_); |
| 1019 | create index ACT_IDX_HI_CAS_A_I_CASEINST on ACT_HI_CASEACTINST(CASE_INST_ID_, CASE_ACT_ID_); |
| 1020 | create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); |
| 1021 | -- create history decision instance table -- |
| 1022 | create table ACT_HI_DECINST ( |
| 1023 | ID_ varchar(64) NOT NULL, |
| 1024 | DEC_DEF_ID_ varchar(64) NOT NULL, |
| 1025 | DEC_DEF_KEY_ varchar(255) NOT NULL, |
| 1026 | DEC_DEF_NAME_ varchar(255), |
| 1027 | PROC_DEF_KEY_ varchar(255), |
| 1028 | PROC_DEF_ID_ varchar(64), |
| 1029 | PROC_INST_ID_ varchar(64), |
| 1030 | CASE_DEF_KEY_ varchar(255), |
| 1031 | CASE_DEF_ID_ varchar(64), |
| 1032 | CASE_INST_ID_ varchar(64), |
| 1033 | ACT_INST_ID_ varchar(64), |
| 1034 | ACT_ID_ varchar(255), |
| 1035 | EVAL_TIME_ datetime(3) not null, |
| 1036 | COLLECT_VALUE_ double, |
| 1037 | USER_ID_ varchar(255), |
| 1038 | ROOT_DEC_INST_ID_ varchar(64), |
| 1039 | DEC_REQ_ID_ varchar(64), |
| 1040 | DEC_REQ_KEY_ varchar(255), |
| 1041 | TENANT_ID_ varchar(64), |
| 1042 | primary key (ID_) |
| 1043 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 1044 | |
| 1045 | -- create history decision input table -- |
| 1046 | create table ACT_HI_DEC_IN ( |
| 1047 | ID_ varchar(64) NOT NULL, |
| 1048 | DEC_INST_ID_ varchar(64) NOT NULL, |
| 1049 | CLAUSE_ID_ varchar(64), |
| 1050 | CLAUSE_NAME_ varchar(255), |
| 1051 | VAR_TYPE_ varchar(100), |
| 1052 | BYTEARRAY_ID_ varchar(64), |
| 1053 | DOUBLE_ double, |
| 1054 | LONG_ bigint, |
| 1055 | TEXT_ LONGBLOB, |
| 1056 | TEXT2_ LONGBLOB, |
| 1057 | TENANT_ID_ varchar(64), |
| 1058 | primary key (ID_) |
| 1059 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 1060 | |
| 1061 | -- create history decision output table -- |
| 1062 | create table ACT_HI_DEC_OUT ( |
| 1063 | ID_ varchar(64) NOT NULL, |
| 1064 | DEC_INST_ID_ varchar(64) NOT NULL, |
| 1065 | CLAUSE_ID_ varchar(64), |
| 1066 | CLAUSE_NAME_ varchar(255), |
| 1067 | RULE_ID_ varchar(64), |
| 1068 | RULE_ORDER_ integer, |
| 1069 | VAR_NAME_ varchar(255), |
| 1070 | VAR_TYPE_ varchar(100), |
| 1071 | BYTEARRAY_ID_ varchar(64), |
| 1072 | DOUBLE_ double, |
| 1073 | LONG_ bigint, |
| 1074 | TEXT_ LONGBLOB, |
| 1075 | TEXT2_ LONGBLOB, |
| 1076 | TENANT_ID_ varchar(64), |
| 1077 | primary key (ID_) |
| 1078 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 1079 | |
| 1080 | |
| 1081 | create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); |
| 1082 | create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); |
| 1083 | create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); |
| 1084 | create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); |
| 1085 | create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); |
| 1086 | create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); |
| 1087 | create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); |
| 1088 | create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); |
| 1089 | create index ACT_IDX_HI_DEC_INST_ROOT_ID on ACT_HI_DECINST(ROOT_DEC_INST_ID_); |
| 1090 | create index ACT_IDX_HI_DEC_INST_REQ_ID on ACT_HI_DECINST(DEC_REQ_ID_); |
| 1091 | create index ACT_IDX_HI_DEC_INST_REQ_KEY on ACT_HI_DECINST(DEC_REQ_KEY_); |
| 1092 | |
| 1093 | |
| 1094 | create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); |
| 1095 | create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); |
| 1096 | |
| 1097 | create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); |
| 1098 | create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); |
| 1099 | |
| 1100 | -- mariadb_identity_7.8.0-ee |
| 1101 | |
| 1102 | create table ACT_ID_GROUP ( |
| 1103 | ID_ varchar(64), |
| 1104 | REV_ integer, |
| 1105 | NAME_ varchar(255), |
| 1106 | TYPE_ varchar(255), |
| 1107 | primary key (ID_) |
| 1108 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 1109 | |
| 1110 | create table ACT_ID_MEMBERSHIP ( |
| 1111 | USER_ID_ varchar(64), |
| 1112 | GROUP_ID_ varchar(64), |
| 1113 | primary key (USER_ID_, GROUP_ID_) |
| 1114 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 1115 | |
| 1116 | create table ACT_ID_USER ( |
| 1117 | ID_ varchar(64), |
| 1118 | REV_ integer, |
| 1119 | FIRST_ varchar(255), |
| 1120 | LAST_ varchar(255), |
| 1121 | EMAIL_ varchar(255), |
| 1122 | PWD_ varchar(255), |
| 1123 | SALT_ varchar(255), |
| 1124 | PICTURE_ID_ varchar(64), |
| 1125 | primary key (ID_) |
| 1126 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 1127 | |
| 1128 | create table ACT_ID_INFO ( |
| 1129 | ID_ varchar(64), |
| 1130 | REV_ integer, |
| 1131 | USER_ID_ varchar(64), |
| 1132 | TYPE_ varchar(64), |
| 1133 | KEY_ varchar(255), |
| 1134 | VALUE_ varchar(255), |
| 1135 | PASSWORD_ LONGBLOB, |
| 1136 | PARENT_ID_ varchar(255), |
| 1137 | primary key (ID_) |
| 1138 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 1139 | |
| 1140 | create table ACT_ID_TENANT ( |
| 1141 | ID_ varchar(64), |
| 1142 | REV_ integer, |
| 1143 | NAME_ varchar(255), |
| 1144 | primary key (ID_) |
| 1145 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 1146 | |
| 1147 | create table ACT_ID_TENANT_MEMBER ( |
| 1148 | ID_ varchar(64) not null, |
| 1149 | TENANT_ID_ varchar(64) not null, |
| 1150 | USER_ID_ varchar(64), |
| 1151 | GROUP_ID_ varchar(64), |
| 1152 | primary key (ID_) |
| 1153 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; |
| 1154 | |
| 1155 | alter table ACT_ID_MEMBERSHIP |
| 1156 | add constraint ACT_FK_MEMB_GROUP |
| 1157 | foreign key (GROUP_ID_) |
| 1158 | references ACT_ID_GROUP (ID_); |
| 1159 | |
| 1160 | alter table ACT_ID_MEMBERSHIP |
| 1161 | add constraint ACT_FK_MEMB_USER |
| 1162 | foreign key (USER_ID_) |
| 1163 | references ACT_ID_USER (ID_); |
| 1164 | |
| 1165 | alter table ACT_ID_TENANT_MEMBER |
| 1166 | add constraint ACT_UNIQ_TENANT_MEMB_USER |
| 1167 | unique (TENANT_ID_, USER_ID_); |
| 1168 | |
| 1169 | alter table ACT_ID_TENANT_MEMBER |
| 1170 | add constraint ACT_UNIQ_TENANT_MEMB_GROUP |
| 1171 | unique (TENANT_ID_, GROUP_ID_); |
| 1172 | |
| 1173 | alter table ACT_ID_TENANT_MEMBER |
| 1174 | add constraint ACT_FK_TENANT_MEMB |
| 1175 | foreign key (TENANT_ID_) |
| 1176 | references ACT_ID_TENANT (ID_); |
| 1177 | |
| 1178 | alter table ACT_ID_TENANT_MEMBER |
| 1179 | add constraint ACT_FK_TENANT_MEMB_USER |
| 1180 | foreign key (USER_ID_) |
| 1181 | references ACT_ID_USER (ID_); |
| 1182 | |
| 1183 | alter table ACT_ID_TENANT_MEMBER |
| 1184 | add constraint ACT_FK_TENANT_MEMB_GROUP |
| 1185 | foreign key (GROUP_ID_) |
| 1186 | references ACT_ID_GROUP (ID_); |
| 1187 | |
| 1188 | |