0%

Activiti7支持达梦数据库

国产化是大势所趋,这里尝试一下达梦数据库

1. 引入达梦数据库连接驱动包

驱动jar—DmJdbcDriver18.jar,可将该jar包上传至阿里云私有maven仓库,并通过maven下载引入。

1
2
3
4
5
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.1.193</version>
</dependency>

2. 配置数据库连接

在application.yml中添加如下内容:

1
2
3
4
5
6
spring:
datasource:
username: ACTIVITI
password: 123456789
jdbc-url: jdbc:dm://192.168.1.39:5236:DAMENG
driver-class-name: dm.jdbc.driver.DmDriver

3. 更改Activiti 默认数据源连接方式

因为Activiti 包中未预设达梦数据库,所以要手动修改默认数据源连接方式。方法为增加类ActivitiConfig,在类中重新定义activiti的配置类SpringProcessEngineConfiguration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.activiti.spring.boot.AbstractProcessEngineAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.transaction.PlatformTransactionManager;

import javax.annotation.Resource;
import javax.sql.DataSource;

//声名为配置类,继承Activiti抽象配置类
@Configuration
public class ActivitiConfig extends AbstractProcessEngineAutoConfiguration {

@Bean
@Primary
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource activitiDataSource() {
return DataSourceBuilder.create().build();
}

@Resource
PlatformTransactionManager activitiTransactionManager;


@Bean
public SpringProcessEngineConfiguration springProcessEngineConfiguration(){
System.out.println("注入activiti的config");
SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration();
DataSource dataSource = activitiDataSource();
configuration.setDataSource(dataSource);
configuration.setDatabaseType("oracle");
configuration.setTransactionManager(activitiTransactionManager);
configuration.setDatabaseSchemaUpdate("none");
return configuration;
}
}

4. 初始化Activiti 所需的表

达梦数据库与oracle兼容,所以可直接执行activiti的oracle的初始sql。

sql语句activiti.oracle.create.engine.sql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
create table ACT_GE_PROPERTY (
NAME_ NVARCHAR2(64),
VALUE_ NVARCHAR2(300),
REV_ INTEGER,
primary key (NAME_)
);

insert into ACT_GE_PROPERTY
values ('schema.version', '7.0.0.0', 1);

insert into ACT_GE_PROPERTY
values ('schema.history', 'create(7.0.0.0)', 1);

insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);

create table ACT_GE_BYTEARRAY (
ID_ NVARCHAR2(64),
REV_ INTEGER,
NAME_ NVARCHAR2(255),
DEPLOYMENT_ID_ NVARCHAR2(64),
BYTES_ BLOB,
GENERATED_ NUMBER(1,0) CHECK (GENERATED_ IN (1,0)),
primary key (ID_)
);

create table ACT_RE_DEPLOYMENT (
ID_ NVARCHAR2(64),
NAME_ NVARCHAR2(255),
CATEGORY_ NVARCHAR2(255),
KEY_ NVARCHAR2(255),
TENANT_ID_ NVARCHAR2(255) DEFAULT '',
DEPLOY_TIME_ TIMESTAMP(6),
ENGINE_VERSION_ NVARCHAR2(255),
primary key (ID_)
);

create table ACT_RE_MODEL (
ID_ NVARCHAR2(64) not null,
REV_ INTEGER,
NAME_ NVARCHAR2(255),
KEY_ NVARCHAR2(255),
CATEGORY_ NVARCHAR2(255),
CREATE_TIME_ TIMESTAMP(6),
LAST_UPDATE_TIME_ TIMESTAMP(6),
VERSION_ INTEGER,
META_INFO_ NVARCHAR2(2000),
DEPLOYMENT_ID_ NVARCHAR2(64),
EDITOR_SOURCE_VALUE_ID_ NVARCHAR2(64),
EDITOR_SOURCE_EXTRA_VALUE_ID_ NVARCHAR2(64),
TENANT_ID_ NVARCHAR2(255) DEFAULT '',
primary key (ID_)
);

create table ACT_RU_EXECUTION (
ID_ NVARCHAR2(64),
REV_ INTEGER,
PROC_INST_ID_ NVARCHAR2(64),
BUSINESS_KEY_ NVARCHAR2(255),
PARENT_ID_ NVARCHAR2(64),
PROC_DEF_ID_ NVARCHAR2(64),
SUPER_EXEC_ NVARCHAR2(64),
ROOT_PROC_INST_ID_ NVARCHAR2(64),
ACT_ID_ NVARCHAR2(255),
IS_ACTIVE_ NUMBER(1,0) CHECK (IS_ACTIVE_ IN (1,0)),
IS_CONCURRENT_ NUMBER(1,0) CHECK (IS_CONCURRENT_ IN (1,0)),
IS_SCOPE_ NUMBER(1,0) CHECK (IS_SCOPE_ IN (1,0)),
IS_EVENT_SCOPE_ NUMBER(1,0) CHECK (IS_EVENT_SCOPE_ IN (1,0)),
IS_MI_ROOT_ NUMBER(1,0) CHECK (IS_MI_ROOT_ IN (1,0)),
SUSPENSION_STATE_ INTEGER,
CACHED_ENT_STATE_ INTEGER,
TENANT_ID_ NVARCHAR2(255) DEFAULT '',
NAME_ NVARCHAR2(255),
START_TIME_ TIMESTAMP(6),
START_USER_ID_ NVARCHAR2(255),
LOCK_TIME_ TIMESTAMP(6),
IS_COUNT_ENABLED_ NUMBER(1,0) CHECK (IS_COUNT_ENABLED_ IN (1,0)),
EVT_SUBSCR_COUNT_ INTEGER,
TASK_COUNT_ INTEGER,
JOB_COUNT_ INTEGER,
TIMER_JOB_COUNT_ INTEGER,
SUSP_JOB_COUNT_ INTEGER,
DEADLETTER_JOB_COUNT_ INTEGER,
VAR_COUNT_ INTEGER,
ID_LINK_COUNT_ INTEGER,
primary key (ID_)
);

create table ACT_RU_JOB (
ID_ NVARCHAR2(64) NOT NULL,
REV_ INTEGER,
TYPE_ NVARCHAR2(255) NOT NULL,
LOCK_EXP_TIME_ TIMESTAMP(6),
LOCK_OWNER_ NVARCHAR2(255),
EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)),
EXECUTION_ID_ NVARCHAR2(64),
PROCESS_INSTANCE_ID_ NVARCHAR2(64),
PROC_DEF_ID_ NVARCHAR2(64),
RETRIES_ INTEGER,
EXCEPTION_STACK_ID_ NVARCHAR2(64),
EXCEPTION_MSG_ NVARCHAR2(2000),
DUEDATE_ TIMESTAMP(6),
REPEAT_ NVARCHAR2(255),
HANDLER_TYPE_ NVARCHAR2(255),
HANDLER_CFG_ NVARCHAR2(2000),
TENANT_ID_ NVARCHAR2(255) DEFAULT '',
primary key (ID_)
);

create table ACT_RU_TIMER_JOB (
ID_ NVARCHAR2(64) NOT NULL,
REV_ INTEGER,
TYPE_ NVARCHAR2(255) NOT NULL,
LOCK_EXP_TIME_ TIMESTAMP(6),
LOCK_OWNER_ NVARCHAR2(255),
EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)),
EXECUTION_ID_ NVARCHAR2(64),
PROCESS_INSTANCE_ID_ NVARCHAR2(64),
PROC_DEF_ID_ NVARCHAR2(64),
RETRIES_ INTEGER,
EXCEPTION_STACK_ID_ NVARCHAR2(64),
EXCEPTION_MSG_ NVARCHAR2(2000),
DUEDATE_ TIMESTAMP(6),
REPEAT_ NVARCHAR2(255),
HANDLER_TYPE_ NVARCHAR2(255),
HANDLER_CFG_ NVARCHAR2(2000),
TENANT_ID_ NVARCHAR2(255) DEFAULT '',
primary key (ID_)
);

create table ACT_RU_SUSPENDED_JOB (
ID_ NVARCHAR2(64) NOT NULL,
REV_ INTEGER,
TYPE_ NVARCHAR2(255) NOT NULL,
EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)),
EXECUTION_ID_ NVARCHAR2(64),
PROCESS_INSTANCE_ID_ NVARCHAR2(64),
PROC_DEF_ID_ NVARCHAR2(64),
RETRIES_ INTEGER,
EXCEPTION_STACK_ID_ NVARCHAR2(64),
EXCEPTION_MSG_ NVARCHAR2(2000),
DUEDATE_ TIMESTAMP(6),
REPEAT_ NVARCHAR2(255),
HANDLER_TYPE_ NVARCHAR2(255),
HANDLER_CFG_ NVARCHAR2(2000),
TENANT_ID_ NVARCHAR2(255) DEFAULT '',
primary key (ID_)
);

create table ACT_RU_DEADLETTER_JOB (
ID_ NVARCHAR2(64) NOT NULL,
REV_ INTEGER,
TYPE_ NVARCHAR2(255) NOT NULL,
EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)),
EXECUTION_ID_ NVARCHAR2(64),
PROCESS_INSTANCE_ID_ NVARCHAR2(64),
PROC_DEF_ID_ NVARCHAR2(64),
EXCEPTION_STACK_ID_ NVARCHAR2(64),
EXCEPTION_MSG_ NVARCHAR2(2000),
DUEDATE_ TIMESTAMP(6),
REPEAT_ NVARCHAR2(255),
HANDLER_TYPE_ NVARCHAR2(255),
HANDLER_CFG_ NVARCHAR2(2000),
TENANT_ID_ NVARCHAR2(255) DEFAULT '',
primary key (ID_)
);

create table ACT_RE_PROCDEF (
ID_ NVARCHAR2(64) NOT NULL,
REV_ INTEGER,
CATEGORY_ NVARCHAR2(255),
NAME_ NVARCHAR2(255),
KEY_ NVARCHAR2(255) NOT NULL,
VERSION_ INTEGER NOT NULL,
DEPLOYMENT_ID_ NVARCHAR2(64),
RESOURCE_NAME_ NVARCHAR2(2000),
DGRM_RESOURCE_NAME_ varchar(4000),
DESCRIPTION_ NVARCHAR2(2000),
HAS_START_FORM_KEY_ NUMBER(1,0) CHECK (HAS_START_FORM_KEY_ IN (1,0)),
HAS_GRAPHICAL_NOTATION_ NUMBER(1,0) CHECK (HAS_GRAPHICAL_NOTATION_ IN (1,0)),
SUSPENSION_STATE_ INTEGER,
TENANT_ID_ NVARCHAR2(255) DEFAULT '',
ENGINE_VERSION_ NVARCHAR2(255),
primary key (ID_)
);

create table ACT_RU_TASK (
ID_ NVARCHAR2(64),
REV_ INTEGER,
EXECUTION_ID_ NVARCHAR2(64),
PROC_INST_ID_ NVARCHAR2(64),
PROC_DEF_ID_ NVARCHAR2(64),
NAME_ NVARCHAR2(255),
PARENT_TASK_ID_ NVARCHAR2(64),
DESCRIPTION_ NVARCHAR2(2000),
TASK_DEF_KEY_ NVARCHAR2(255),
OWNER_ NVARCHAR2(255),
ASSIGNEE_ NVARCHAR2(255),
DELEGATION_ NVARCHAR2(64),
PRIORITY_ INTEGER,
CREATE_TIME_ TIMESTAMP(6),
DUE_DATE_ TIMESTAMP(6),
CATEGORY_ NVARCHAR2(255),
SUSPENSION_STATE_ INTEGER,
TENANT_ID_ NVARCHAR2(255) DEFAULT '',
FORM_KEY_ NVARCHAR2(255),
CLAIM_TIME_ TIMESTAMP(6),
primary key (ID_)
);

create table ACT_RU_IDENTITYLINK (
ID_ NVARCHAR2(64),
REV_ INTEGER,
GROUP_ID_ NVARCHAR2(255),
TYPE_ NVARCHAR2(255),
USER_ID_ NVARCHAR2(255),
TASK_ID_ NVARCHAR2(64),
PROC_INST_ID_ NVARCHAR2(64),
PROC_DEF_ID_ NVARCHAR2(64),
primary key (ID_)
);

create table ACT_RU_VARIABLE (
ID_ NVARCHAR2(64) not null,
REV_ INTEGER,
TYPE_ NVARCHAR2(255) not null,
NAME_ NVARCHAR2(255) not null,
EXECUTION_ID_ NVARCHAR2(64),
PROC_INST_ID_ NVARCHAR2(64),
TASK_ID_ NVARCHAR2(64),
BYTEARRAY_ID_ NVARCHAR2(64),
DOUBLE_ NUMBER(*,10),
LONG_ NUMBER(19,0),
TEXT_ NVARCHAR2(2000),
TEXT2_ NVARCHAR2(2000),
primary key (ID_)
);

create table ACT_RU_EVENT_SUBSCR (
ID_ NVARCHAR2(64) not null,
REV_ integer,
EVENT_TYPE_ NVARCHAR2(255) not null,
EVENT_NAME_ NVARCHAR2(255),
EXECUTION_ID_ NVARCHAR2(64),
PROC_INST_ID_ NVARCHAR2(64),
ACTIVITY_ID_ NVARCHAR2(64),
CONFIGURATION_ NVARCHAR2(255),
CREATED_ TIMESTAMP(6) not null,
PROC_DEF_ID_ NVARCHAR2(64),
TENANT_ID_ NVARCHAR2(255) DEFAULT '',
primary key (ID_)
);

create table ACT_EVT_LOG (
LOG_NR_ NUMBER(19),
TYPE_ NVARCHAR2(64),
PROC_DEF_ID_ NVARCHAR2(64),
PROC_INST_ID_ NVARCHAR2(64),
EXECUTION_ID_ NVARCHAR2(64),
TASK_ID_ NVARCHAR2(64),
TIME_STAMP_ TIMESTAMP(6) not null,
USER_ID_ NVARCHAR2(255),
DATA_ BLOB,
LOCK_OWNER_ NVARCHAR2(255),
LOCK_TIME_ TIMESTAMP(6) null,
IS_PROCESSED_ NUMBER(3) default 0,
primary key (LOG_NR_)
);

create sequence act_evt_log_seq;

create table ACT_PROCDEF_INFO (
ID_ NVARCHAR2(64) not null,
PROC_DEF_ID_ NVARCHAR2(64) not null,
REV_ integer,
INFO_JSON_ID_ NVARCHAR2(64),
primary key (ID_)
);

create table ACT_RU_INTEGRATION (
ID_ NVARCHAR2(64) not null,
EXECUTION_ID_ NVARCHAR2(64),
PROCESS_INSTANCE_ID_ NVARCHAR2(64),
PROC_DEF_ID_ NVARCHAR2(64),
FLOW_NODE_ID_ NVARCHAR2(64),
CREATED_DATE_ TIMESTAMP(6),
primary key (ID_)
);

create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_);
create index ACT_IDX_EXEC_ROOT on ACT_RU_EXECUTION(ROOT_PROC_INST_ID_);
create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_);
create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_);
create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_);
create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_);
create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_);

create index ACT_IDX_BYTEAR_DEPL on ACT_GE_BYTEARRAY(DEPLOYMENT_ID_);
alter table ACT_GE_BYTEARRAY
add constraint ACT_FK_BYTEARR_DEPL
foreign key (DEPLOYMENT_ID_)
references ACT_RE_DEPLOYMENT (ID_);

alter table ACT_RE_PROCDEF
add constraint ACT_UNIQ_PROCDEF
unique (KEY_,VERSION_, TENANT_ID_);

create index ACT_IDX_EXE_PROCINST on ACT_RU_EXECUTION(PROC_INST_ID_);
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_EXE_PARENT on ACT_RU_EXECUTION(PARENT_ID_);
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PARENT
foreign key (PARENT_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_EXE_SUPER on ACT_RU_EXECUTION(SUPER_EXEC_);
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_SUPER
foreign key (SUPER_EXEC_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_EXE_PROCDEF on ACT_RU_EXECUTION(PROC_DEF_ID_);
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_TSKASS_TASK on ACT_RU_IDENTITYLINK(TASK_ID_);
alter table ACT_RU_IDENTITYLINK
add constraint ACT_FK_TSKASS_TASK
foreign key (TASK_ID_)
references ACT_RU_TASK (ID_);

create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_);
alter table ACT_RU_IDENTITYLINK
add constraint ACT_FK_ATHRZ_PROCEDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_IDL_PROCINST on ACT_RU_IDENTITYLINK(PROC_INST_ID_);
alter table ACT_RU_IDENTITYLINK
add constraint ACT_FK_IDL_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_TASK_EXEC on ACT_RU_TASK(EXECUTION_ID_);
alter table ACT_RU_TASK
add constraint ACT_FK_TASK_EXE
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_TASK_PROCINST on ACT_RU_TASK(PROC_INST_ID_);
alter table ACT_RU_TASK
add constraint ACT_FK_TASK_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_TASK_PROCDEF on ACT_RU_TASK(PROC_DEF_ID_);
alter table ACT_RU_TASK
add constraint ACT_FK_TASK_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_VAR_EXE on ACT_RU_VARIABLE(EXECUTION_ID_);
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_EXE
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_VAR_PROCINST on ACT_RU_VARIABLE(PROC_INST_ID_);
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION(ID_);

create index ACT_IDX_VAR_BYTEARRAY on ACT_RU_VARIABLE(BYTEARRAY_ID_);
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_BYTEARRAY
foreign key (BYTEARRAY_ID_)
references ACT_GE_BYTEARRAY (ID_);

create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_);
alter table ACT_RU_JOB
add constraint ACT_FK_JOB_EXECUTION
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_JOB_PROC_INST_ID on ACT_RU_JOB(PROCESS_INSTANCE_ID_);
alter table ACT_RU_JOB
add constraint ACT_FK_JOB_PROCESS_INSTANCE
foreign key (PROCESS_INSTANCE_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_JOB_PROC_DEF_ID on ACT_RU_JOB(PROC_DEF_ID_);
alter table ACT_RU_JOB
add constraint ACT_FK_JOB_PROC_DEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_JOB_EXCEPTION on ACT_RU_JOB(EXCEPTION_STACK_ID_);
alter table ACT_RU_JOB
add constraint ACT_FK_JOB_EXCEPTION
foreign key (EXCEPTION_STACK_ID_)
references ACT_GE_BYTEARRAY (ID_);

create index ACT_IDX_TJOB_EXECUTION_ID on ACT_RU_TIMER_JOB(EXECUTION_ID_);
alter table ACT_RU_TIMER_JOB
add constraint ACT_FK_TJOB_EXECUTION
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_TJOB_PROC_INST_ID on ACT_RU_TIMER_JOB(PROCESS_INSTANCE_ID_);
alter table ACT_RU_TIMER_JOB
add constraint ACT_FK_TJOB_PROCESS_INSTANCE
foreign key (PROCESS_INSTANCE_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_TJOB_PROC_DEF_ID on ACT_RU_TIMER_JOB(PROC_DEF_ID_);
alter table ACT_RU_TIMER_JOB
add constraint ACT_FK_TJOB_PROC_DEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_TJOB_EXCEPTION on ACT_RU_TIMER_JOB(EXCEPTION_STACK_ID_);
alter table ACT_RU_TIMER_JOB
add constraint ACT_FK_TJOB_EXCEPTION
foreign key (EXCEPTION_STACK_ID_)
references ACT_GE_BYTEARRAY (ID_);

create index ACT_IDX_SJOB_EXECUTION_ID on ACT_RU_SUSPENDED_JOB(EXECUTION_ID_);
alter table ACT_RU_SUSPENDED_JOB
add constraint ACT_FK_SJOB_EXECUTION
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_SJOB_PROC_INST_ID on ACT_RU_SUSPENDED_JOB(PROCESS_INSTANCE_ID_);
alter table ACT_RU_SUSPENDED_JOB
add constraint ACT_FK_SJOB_PROCESS_INSTANCE
foreign key (PROCESS_INSTANCE_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_SJOB_PROC_DEF_ID on ACT_RU_SUSPENDED_JOB(PROC_DEF_ID_);
alter table ACT_RU_SUSPENDED_JOB
add constraint ACT_FK_SJOB_PROC_DEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_SJOB_EXCEPTION on ACT_RU_SUSPENDED_JOB(EXCEPTION_STACK_ID_);
alter table ACT_RU_SUSPENDED_JOB
add constraint ACT_FK_SJOB_EXCEPTION
foreign key (EXCEPTION_STACK_ID_)
references ACT_GE_BYTEARRAY (ID_);

create index ACT_IDX_DJOB_EXECUTION_ID on ACT_RU_DEADLETTER_JOB(EXECUTION_ID_);
alter table ACT_RU_DEADLETTER_JOB
add constraint ACT_FK_DJOB_EXECUTION
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_DJOB_PROC_INST_ID on ACT_RU_DEADLETTER_JOB(PROCESS_INSTANCE_ID_);
alter table ACT_RU_DEADLETTER_JOB
add constraint ACT_FK_DJOB_PROCESS_INSTANCE
foreign key (PROCESS_INSTANCE_ID_)
references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_DJOB_PROC_DEF_ID on ACT_RU_DEADLETTER_JOB(PROC_DEF_ID_);
alter table ACT_RU_DEADLETTER_JOB
add constraint ACT_FK_DJOB_PROC_DEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_DJOB_EXCEPTION on ACT_RU_DEADLETTER_JOB(EXCEPTION_STACK_ID_);
alter table ACT_RU_DEADLETTER_JOB
add constraint ACT_FK_DJOB_EXCEPTION
foreign key (EXCEPTION_STACK_ID_)
references ACT_GE_BYTEARRAY (ID_);

create index ACT_IDX_EVENT_SUBSCR on ACT_RU_EVENT_SUBSCR(EXECUTION_ID_);
alter table ACT_RU_EVENT_SUBSCR
add constraint ACT_FK_EVENT_EXEC
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION(ID_);

create index ACT_IDX_MODEL_SOURCE on ACT_RE_MODEL(EDITOR_SOURCE_VALUE_ID_);
alter table ACT_RE_MODEL
add constraint ACT_FK_MODEL_SOURCE
foreign key (EDITOR_SOURCE_VALUE_ID_)
references ACT_GE_BYTEARRAY (ID_);

create index ACT_IDX_MODEL_SOURCE_EXTRA on ACT_RE_MODEL(EDITOR_SOURCE_EXTRA_VALUE_ID_);
alter table ACT_RE_MODEL
add constraint ACT_FK_MODEL_SOURCE_EXTRA
foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_)
references ACT_GE_BYTEARRAY (ID_);

create index ACT_IDX_MODEL_DEPLOYMENT on ACT_RE_MODEL(DEPLOYMENT_ID_);
alter table ACT_RE_MODEL
add constraint ACT_FK_MODEL_DEPLOYMENT
foreign key (DEPLOYMENT_ID_)
references ACT_RE_DEPLOYMENT (ID_);

create index ACT_IDX_PROCDEF_INFO_JSON on ACT_PROCDEF_INFO(INFO_JSON_ID_);
alter table ACT_PROCDEF_INFO
add constraint ACT_FK_INFO_JSON_BA
foreign key (INFO_JSON_ID_)
references ACT_GE_BYTEARRAY (ID_);

create index ACT_IDX_PROCDEF_INFO_PROC on ACT_PROCDEF_INFO(PROC_DEF_ID_);
alter table ACT_PROCDEF_INFO
add constraint ACT_FK_INFO_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);

alter table ACT_PROCDEF_INFO
add constraint ACT_UNIQ_INFO_PROCDEF
unique (PROC_DEF_ID_);

alter table ACT_RU_INTEGRATION
add constraint ACT_FK_INT_EXECUTION
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION (ID_)
on delete cascade;

alter table ACT_RU_INTEGRATION
add constraint ACT_FK_INT_PROC_INST
foreign key (PROCESS_INSTANCE_ID_)
references ACT_RU_EXECUTION (ID_);

alter table ACT_RU_INTEGRATION
add constraint ACT_FK_INT_PROC_DEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);

activiti.oracle.create.history.sql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
create table ACT_HI_PROCINST (
ID_ NVARCHAR2(64) not null,
PROC_INST_ID_ NVARCHAR2(64) not null,
BUSINESS_KEY_ NVARCHAR2(255),
PROC_DEF_ID_ NVARCHAR2(64) not null,
START_TIME_ TIMESTAMP(6) not null,
END_TIME_ TIMESTAMP(6),
DURATION_ NUMBER(19,0),
START_USER_ID_ NVARCHAR2(255),
START_ACT_ID_ NVARCHAR2(255),
END_ACT_ID_ NVARCHAR2(255),
SUPER_PROCESS_INSTANCE_ID_ NVARCHAR2(64),
DELETE_REASON_ NVARCHAR2(2000),
TENANT_ID_ NVARCHAR2(255) default '',
NAME_ NVARCHAR2(255),
primary key (ID_),
unique (PROC_INST_ID_)
);

create table ACT_HI_ACTINST (
ID_ NVARCHAR2(64) not null,
PROC_DEF_ID_ NVARCHAR2(64) not null,
PROC_INST_ID_ NVARCHAR2(64) not null,
EXECUTION_ID_ NVARCHAR2(64) not null,
ACT_ID_ NVARCHAR2(255) not null,
TASK_ID_ NVARCHAR2(64),
CALL_PROC_INST_ID_ NVARCHAR2(64),
ACT_NAME_ NVARCHAR2(255),
ACT_TYPE_ NVARCHAR2(255) not null,
ASSIGNEE_ NVARCHAR2(255),
START_TIME_ TIMESTAMP(6) not null,
END_TIME_ TIMESTAMP(6),
DURATION_ NUMBER(19,0),
DELETE_REASON_ NVARCHAR2(2000),
TENANT_ID_ NVARCHAR2(255) default '',
primary key (ID_)
);

create table ACT_HI_TASKINST (
ID_ NVARCHAR2(64) not null,
PROC_DEF_ID_ NVARCHAR2(64),
TASK_DEF_KEY_ NVARCHAR2(255),
PROC_INST_ID_ NVARCHAR2(64),
EXECUTION_ID_ NVARCHAR2(64),
PARENT_TASK_ID_ NVARCHAR2(64),
NAME_ NVARCHAR2(255),
DESCRIPTION_ NVARCHAR2(2000),
OWNER_ NVARCHAR2(255),
ASSIGNEE_ NVARCHAR2(255),
START_TIME_ TIMESTAMP(6) not null,
CLAIM_TIME_ TIMESTAMP(6),
END_TIME_ TIMESTAMP(6),
DURATION_ NUMBER(19,0),
DELETE_REASON_ NVARCHAR2(2000),
PRIORITY_ INTEGER,
DUE_DATE_ TIMESTAMP(6),
FORM_KEY_ NVARCHAR2(255),
CATEGORY_ NVARCHAR2(255),
TENANT_ID_ NVARCHAR2(255) default '',
primary key (ID_)
);

create table ACT_HI_VARINST (
ID_ NVARCHAR2(64) not null,
PROC_INST_ID_ NVARCHAR2(64),
EXECUTION_ID_ NVARCHAR2(64),
TASK_ID_ NVARCHAR2(64),
NAME_ NVARCHAR2(255) not null,
VAR_TYPE_ NVARCHAR2(100),
REV_ INTEGER,
BYTEARRAY_ID_ NVARCHAR2(64),
DOUBLE_ NUMBER(*,10),
LONG_ NUMBER(19,0),
TEXT_ NVARCHAR2(2000),
TEXT2_ NVARCHAR2(2000),
CREATE_TIME_ TIMESTAMP(6),
LAST_UPDATED_TIME_ TIMESTAMP(6),
primary key (ID_)
);

create table ACT_HI_DETAIL (
ID_ NVARCHAR2(64) not null,
TYPE_ NVARCHAR2(255) not null,
PROC_INST_ID_ NVARCHAR2(64),
EXECUTION_ID_ NVARCHAR2(64),
TASK_ID_ NVARCHAR2(64),
ACT_INST_ID_ NVARCHAR2(64),
NAME_ NVARCHAR2(255) not null,
VAR_TYPE_ NVARCHAR2(64),
REV_ INTEGER,
TIME_ TIMESTAMP(6) not null,
BYTEARRAY_ID_ NVARCHAR2(64),
DOUBLE_ NUMBER(*,10),
LONG_ NUMBER(19,0),
TEXT_ NVARCHAR2(2000),
TEXT2_ NVARCHAR2(2000),
primary key (ID_)
);

create table ACT_HI_COMMENT (
ID_ NVARCHAR2(64) not null,
TYPE_ NVARCHAR2(255),
TIME_ TIMESTAMP(6) not null,
USER_ID_ NVARCHAR2(255),
TASK_ID_ NVARCHAR2(64),
PROC_INST_ID_ NVARCHAR2(64),
ACTION_ NVARCHAR2(255),
MESSAGE_ NVARCHAR2(2000),
FULL_MSG_ BLOB,
primary key (ID_)
);

create table ACT_HI_ATTACHMENT (
ID_ NVARCHAR2(64) not null,
REV_ INTEGER,
USER_ID_ NVARCHAR2(255),
NAME_ NVARCHAR2(255),
DESCRIPTION_ NVARCHAR2(2000),
TYPE_ NVARCHAR2(255),
TASK_ID_ NVARCHAR2(64),
PROC_INST_ID_ NVARCHAR2(64),
URL_ NVARCHAR2(2000),
CONTENT_ID_ NVARCHAR2(64),
TIME_ TIMESTAMP(6),
primary key (ID_)
);

create table ACT_HI_IDENTITYLINK (
ID_ NVARCHAR2(64),
GROUP_ID_ NVARCHAR2(255),
TYPE_ NVARCHAR2(255),
USER_ID_ NVARCHAR2(255),
TASK_ID_ NVARCHAR2(64),
PROC_INST_ID_ NVARCHAR2(64),
primary key (ID_)
);

create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_);
create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_);
create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_);
create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_);
create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_);
create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_);
create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_);
create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_);
create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_);
create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_);
create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_);
create index ACT_IDX_HI_PROCVAR_TASK_ID on ACT_HI_VARINST(TASK_ID_);
create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_);
create index ACT_IDX_HI_IDENT_LNK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_);
create index ACT_IDX_HI_IDENT_LNK_PROCINST on ACT_HI_IDENTITYLINK(PROC_INST_ID_);

create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_);
create index ACT_IDX_HI_ACT_INST_EXEC on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_);
create index ACT_IDX_HI_TASK_INST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_);

5. 修正缺失字段

官方初始化sql中缺少ACT_RE_DEPLOYMENT表的PROJECT_RELEASE_VERSION_VERSION_字段,可执行下列sql语句进行增加。

1
2
alter table ACT_RE_DEPLOYMENT add column PROJECT_RELEASE_VERSION_ varchar(255) DEFAULT NULL;
alter table ACT_RE_DEPLOYMENT add column VERSION_ varchar(255) DEFAULT NULL;