activiti.hsql.create.engine.sql 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. create table ACT_GE_PROPERTY (
  2. NAME_ varchar(64),
  3. VALUE_ varchar(300),
  4. REV_ integer,
  5. primary key (NAME_)
  6. );
  7. insert into ACT_GE_PROPERTY
  8. values ('schema.version', '5.22.0.0', 1);
  9. insert into ACT_GE_PROPERTY
  10. values ('schema.history', 'create(5.22.0.0)', 1);
  11. insert into ACT_GE_PROPERTY
  12. values ('next.dbid', '1', 1);
  13. create table ACT_GE_BYTEARRAY (
  14. ID_ varchar(64),
  15. REV_ integer,
  16. NAME_ varchar(255),
  17. DEPLOYMENT_ID_ varchar(64),
  18. BYTES_ longvarbinary,
  19. GENERATED_ bit,
  20. primary key (ID_)
  21. );
  22. create table ACT_RE_DEPLOYMENT (
  23. ID_ varchar(64),
  24. NAME_ varchar(255),
  25. CATEGORY_ varchar(255),
  26. TENANT_ID_ varchar(255) default '',
  27. DEPLOY_TIME_ timestamp,
  28. primary key (ID_)
  29. );
  30. create table ACT_RE_MODEL (
  31. ID_ varchar(64) not null,
  32. REV_ integer,
  33. NAME_ varchar(255),
  34. KEY_ varchar(255),
  35. CATEGORY_ varchar(255),
  36. CREATE_TIME_ timestamp,
  37. LAST_UPDATE_TIME_ timestamp,
  38. VERSION_ integer,
  39. META_INFO_ varchar(4000),
  40. DEPLOYMENT_ID_ varchar(64),
  41. EDITOR_SOURCE_VALUE_ID_ varchar(64),
  42. EDITOR_SOURCE_EXTRA_VALUE_ID_ varchar(64),
  43. TENANT_ID_ varchar(255) default '',
  44. primary key (ID_)
  45. );
  46. create table ACT_RU_EXECUTION (
  47. ID_ varchar(64),
  48. REV_ integer,
  49. PROC_INST_ID_ varchar(64),
  50. BUSINESS_KEY_ varchar(255),
  51. PARENT_ID_ varchar(64),
  52. PROC_DEF_ID_ varchar(64),
  53. SUPER_EXEC_ varchar(64),
  54. ACT_ID_ varchar(255),
  55. IS_ACTIVE_ bit,
  56. IS_CONCURRENT_ bit,
  57. IS_SCOPE_ bit,
  58. IS_EVENT_SCOPE_ bit,
  59. SUSPENSION_STATE_ integer,
  60. CACHED_ENT_STATE_ integer,
  61. TENANT_ID_ varchar(255) default '',
  62. NAME_ varchar(255),
  63. LOCK_TIME_ timestamp,
  64. primary key (ID_)
  65. );
  66. create table ACT_RU_JOB (
  67. ID_ varchar(64) NOT NULL,
  68. REV_ integer,
  69. TYPE_ varchar(255) NOT NULL,
  70. LOCK_EXP_TIME_ timestamp,
  71. LOCK_OWNER_ varchar(255),
  72. EXCLUSIVE_ boolean,
  73. EXECUTION_ID_ varchar(64),
  74. PROCESS_INSTANCE_ID_ varchar(64),
  75. PROC_DEF_ID_ varchar(64),
  76. RETRIES_ integer,
  77. EXCEPTION_STACK_ID_ varchar(64),
  78. EXCEPTION_MSG_ varchar(4000),
  79. DUEDATE_ timestamp,
  80. REPEAT_ varchar(255),
  81. HANDLER_TYPE_ varchar(255),
  82. HANDLER_CFG_ varchar(4000),
  83. TENANT_ID_ varchar(255) default '',
  84. primary key (ID_)
  85. );
  86. create table ACT_RE_PROCDEF (
  87. ID_ varchar(64) NOT NULL,
  88. REV_ integer,
  89. CATEGORY_ varchar(255),
  90. NAME_ varchar(255),
  91. KEY_ varchar(255) NOT NULL,
  92. VERSION_ integer NOT NULL,
  93. DEPLOYMENT_ID_ varchar(64),
  94. RESOURCE_NAME_ varchar(4000),
  95. DGRM_RESOURCE_NAME_ varchar(4000),
  96. DESCRIPTION_ varchar(4000),
  97. HAS_START_FORM_KEY_ bit,
  98. HAS_GRAPHICAL_NOTATION_ bit,
  99. SUSPENSION_STATE_ integer,
  100. TENANT_ID_ varchar(255) default '',
  101. primary key (ID_)
  102. );
  103. create table ACT_RU_TASK (
  104. ID_ varchar(64),
  105. REV_ integer,
  106. EXECUTION_ID_ varchar(64),
  107. PROC_INST_ID_ varchar(64),
  108. PROC_DEF_ID_ varchar(64),
  109. NAME_ varchar(255),
  110. PARENT_TASK_ID_ varchar(64),
  111. DESCRIPTION_ varchar(4000),
  112. TASK_DEF_KEY_ varchar(255),
  113. OWNER_ varchar(255),
  114. ASSIGNEE_ varchar(255),
  115. DELEGATION_ varchar(64),
  116. PRIORITY_ integer,
  117. CREATE_TIME_ timestamp,
  118. DUE_DATE_ timestamp,
  119. CATEGORY_ varchar(255),
  120. SUSPENSION_STATE_ integer,
  121. TENANT_ID_ varchar(255) default '',
  122. FORM_KEY_ varchar(255),
  123. primary key (ID_)
  124. );
  125. create table ACT_RU_IDENTITYLINK (
  126. ID_ varchar(64),
  127. REV_ integer,
  128. GROUP_ID_ varchar(255),
  129. TYPE_ varchar(255),
  130. USER_ID_ varchar(255),
  131. TASK_ID_ varchar(64),
  132. PROC_INST_ID_ varchar(64) null,
  133. PROC_DEF_ID_ varchar(64),
  134. primary key (ID_)
  135. );
  136. create table ACT_RU_VARIABLE (
  137. ID_ varchar(64) not null,
  138. REV_ integer,
  139. TYPE_ varchar(255) not null,
  140. NAME_ varchar(255) not null,
  141. EXECUTION_ID_ varchar(64),
  142. PROC_INST_ID_ varchar(64),
  143. TASK_ID_ varchar(64),
  144. BYTEARRAY_ID_ varchar(64),
  145. DOUBLE_ double,
  146. LONG_ bigint,
  147. TEXT_ varchar(4000),
  148. TEXT2_ varchar(4000),
  149. primary key (ID_)
  150. );
  151. create table ACT_RU_EVENT_SUBSCR (
  152. ID_ varchar(64) not null,
  153. REV_ integer,
  154. EVENT_TYPE_ varchar(255) not null,
  155. EVENT_NAME_ varchar(255),
  156. EXECUTION_ID_ varchar(64),
  157. PROC_INST_ID_ varchar(64),
  158. ACTIVITY_ID_ varchar(64),
  159. CONFIGURATION_ varchar(255),
  160. CREATED_ timestamp not null,
  161. PROC_DEF_ID_ varchar(64),
  162. TENANT_ID_ varchar(255) default '',
  163. primary key (ID_)
  164. );
  165. create table ACT_EVT_LOG (
  166. LOG_NR_ identity,
  167. TYPE_ varchar(64),
  168. PROC_DEF_ID_ varchar(64),
  169. PROC_INST_ID_ varchar(64),
  170. EXECUTION_ID_ varchar(64),
  171. TASK_ID_ varchar(64),
  172. TIME_STAMP_ timestamp not null,
  173. USER_ID_ varchar(255),
  174. DATA_ longvarbinary,
  175. LOCK_OWNER_ varchar(255),
  176. LOCK_TIME_ timestamp,
  177. IS_PROCESSED_ bit default 0
  178. );
  179. create table ACT_PROCDEF_INFO (
  180. ID_ varchar(64) not null,
  181. PROC_DEF_ID_ varchar(64) not null,
  182. REV_ integer,
  183. INFO_JSON_ID_ varchar(64),
  184. primary key (ID_)
  185. );
  186. create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_);
  187. create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_);
  188. create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_);
  189. create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_);
  190. create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_);
  191. create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_);
  192. create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_);
  193. create index ACT_IDX_INFO_PROCDEF on ACT_PROCDEF_INFO(PROC_DEF_ID_);
  194. alter table ACT_GE_BYTEARRAY
  195. add constraint ACT_FK_BYTEARR_DEPL
  196. foreign key (DEPLOYMENT_ID_)
  197. references ACT_RE_DEPLOYMENT;
  198. alter table ACT_RE_PROCDEF
  199. add constraint ACT_UNIQ_PROCDEF
  200. unique (KEY_,VERSION_, TENANT_ID_);
  201. alter table ACT_RU_EXECUTION
  202. add constraint ACT_FK_EXE_PROCINST
  203. foreign key (PROC_INST_ID_)
  204. references ACT_RU_EXECUTION;
  205. alter table ACT_RU_EXECUTION
  206. add constraint ACT_FK_EXE_PARENT
  207. foreign key (PARENT_ID_)
  208. references ACT_RU_EXECUTION;
  209. alter table ACT_RU_EXECUTION
  210. add constraint ACT_FK_EXE_SUPER
  211. foreign key (SUPER_EXEC_)
  212. references ACT_RU_EXECUTION;
  213. alter table ACT_RU_EXECUTION
  214. add constraint ACT_FK_EXE_PROCDEF
  215. foreign key (PROC_DEF_ID_)
  216. references ACT_RE_PROCDEF (ID_);
  217. alter table ACT_RU_IDENTITYLINK
  218. add constraint ACT_FK_TSKASS_TASK
  219. foreign key (TASK_ID_)
  220. references ACT_RU_TASK;
  221. alter table ACT_RU_IDENTITYLINK
  222. add constraint ACT_FK_ATHRZ_PROCEDEF
  223. foreign key (PROC_DEF_ID_)
  224. references ACT_RE_PROCDEF;
  225. alter table ACT_RU_IDENTITYLINK
  226. add constraint ACT_FK_IDL_PROCINST
  227. foreign key (PROC_INST_ID_)
  228. references ACT_RU_EXECUTION (ID_);
  229. alter table ACT_RU_TASK
  230. add constraint ACT_FK_TASK_EXE
  231. foreign key (EXECUTION_ID_)
  232. references ACT_RU_EXECUTION;
  233. alter table ACT_RU_TASK
  234. add constraint ACT_FK_TASK_PROCINST
  235. foreign key (PROC_INST_ID_)
  236. references ACT_RU_EXECUTION;
  237. alter table ACT_RU_TASK
  238. add constraint ACT_FK_TASK_PROCDEF
  239. foreign key (PROC_DEF_ID_)
  240. references ACT_RE_PROCDEF;
  241. alter table ACT_RU_VARIABLE
  242. add constraint ACT_FK_VAR_EXE
  243. foreign key (EXECUTION_ID_)
  244. references ACT_RU_EXECUTION;
  245. alter table ACT_RU_VARIABLE
  246. add constraint ACT_FK_VAR_PROCINST
  247. foreign key (PROC_INST_ID_)
  248. references ACT_RU_EXECUTION;
  249. alter table ACT_RU_VARIABLE
  250. add constraint ACT_FK_VAR_BYTEARRAY
  251. foreign key (BYTEARRAY_ID_)
  252. references ACT_GE_BYTEARRAY;
  253. alter table ACT_RU_JOB
  254. add constraint ACT_FK_JOB_EXCEPTION
  255. foreign key (EXCEPTION_STACK_ID_)
  256. references ACT_GE_BYTEARRAY;
  257. alter table ACT_RU_EVENT_SUBSCR
  258. add constraint ACT_FK_EVENT_EXEC
  259. foreign key (EXECUTION_ID_)
  260. references ACT_RU_EXECUTION;
  261. alter table ACT_RE_MODEL
  262. add constraint ACT_FK_MODEL_SOURCE
  263. foreign key (EDITOR_SOURCE_VALUE_ID_)
  264. references ACT_GE_BYTEARRAY (ID_);
  265. alter table ACT_RE_MODEL
  266. add constraint ACT_FK_MODEL_SOURCE_EXTRA
  267. foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_)
  268. references ACT_GE_BYTEARRAY (ID_);
  269. alter table ACT_RE_MODEL
  270. add constraint ACT_FK_MODEL_DEPLOYMENT
  271. foreign key (DEPLOYMENT_ID_)
  272. references ACT_RE_DEPLOYMENT (ID_);
  273. alter table ACT_PROCDEF_INFO
  274. add constraint ACT_FK_INFO_JSON_BA
  275. foreign key (INFO_JSON_ID_)
  276. references ACT_GE_BYTEARRAY (ID_);
  277. alter table ACT_PROCDEF_INFO
  278. add constraint ACT_FK_INFO_PROCDEF
  279. foreign key (PROC_DEF_ID_)
  280. references ACT_RE_PROCDEF (ID_);
  281. alter table ACT_PROCDEF_INFO
  282. add constraint ACT_UNIQ_INFO_PROCDEF
  283. unique (PROC_DEF_ID_);