activiti.mysql55.create.engine.sql 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. create table ACT_GE_PROPERTY (
  2. NAME_ varchar(64),
  3. VALUE_ varchar(300),
  4. REV_ integer,
  5. primary key (NAME_)
  6. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  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_ LONGBLOB,
  19. GENERATED_ TINYINT,
  20. primary key (ID_)
  21. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  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 NULL,
  28. primary key (ID_)
  29. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  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 null,
  37. LAST_UPDATE_TIME_ timestamp null,
  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. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  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_ TINYINT,
  56. IS_CONCURRENT_ TINYINT,
  57. IS_SCOPE_ TINYINT,
  58. IS_EVENT_SCOPE_ TINYINT,
  59. SUSPENSION_STATE_ integer,
  60. CACHED_ENT_STATE_ integer,
  61. TENANT_ID_ varchar(255) default '',
  62. NAME_ varchar(255),
  63. LOCK_TIME_ timestamp NULL,
  64. primary key (ID_)
  65. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  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 NULL,
  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 NULL,
  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. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  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_ TINYINT,
  98. HAS_GRAPHICAL_NOTATION_ TINYINT,
  99. SUSPENSION_STATE_ integer,
  100. TENANT_ID_ varchar(255) default '',
  101. primary key (ID_)
  102. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  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 NULL,
  118. DUE_DATE_ datetime,
  119. CATEGORY_ varchar(255),
  120. SUSPENSION_STATE_ integer,
  121. TENANT_ID_ varchar(255) default '',
  122. FORM_KEY_ varchar(255),
  123. primary key (ID_)
  124. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  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),
  133. PROC_DEF_ID_ varchar(64),
  134. primary key (ID_)
  135. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  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. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  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 DEFAULT CURRENT_TIMESTAMP,
  161. PROC_DEF_ID_ varchar(64),
  162. TENANT_ID_ varchar(255) default '',
  163. primary key (ID_)
  164. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  165. create table ACT_EVT_LOG (
  166. LOG_NR_ bigint auto_increment,
  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_ LONGBLOB,
  175. LOCK_OWNER_ varchar(255),
  176. LOCK_TIME_ timestamp null,
  177. IS_PROCESSED_ tinyint default 0,
  178. primary key (LOG_NR_)
  179. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  180. create table ACT_PROCDEF_INFO (
  181. ID_ varchar(64) not null,
  182. PROC_DEF_ID_ varchar(64) not null,
  183. REV_ integer,
  184. INFO_JSON_ID_ varchar(64),
  185. primary key (ID_)
  186. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  187. create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_);
  188. create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_);
  189. create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_);
  190. create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_);
  191. create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_);
  192. create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_);
  193. create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_);
  194. create index ACT_IDX_INFO_PROCDEF on ACT_PROCDEF_INFO(PROC_DEF_ID_);
  195. alter table ACT_GE_BYTEARRAY
  196. add constraint ACT_FK_BYTEARR_DEPL
  197. foreign key (DEPLOYMENT_ID_)
  198. references ACT_RE_DEPLOYMENT (ID_);
  199. alter table ACT_RE_PROCDEF
  200. add constraint ACT_UNIQ_PROCDEF
  201. unique (KEY_,VERSION_, TENANT_ID_);
  202. alter table ACT_RU_EXECUTION
  203. add constraint ACT_FK_EXE_PROCINST
  204. foreign key (PROC_INST_ID_)
  205. references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade;
  206. alter table ACT_RU_EXECUTION
  207. add constraint ACT_FK_EXE_PARENT
  208. foreign key (PARENT_ID_)
  209. references ACT_RU_EXECUTION (ID_);
  210. alter table ACT_RU_EXECUTION
  211. add constraint ACT_FK_EXE_SUPER
  212. foreign key (SUPER_EXEC_)
  213. references ACT_RU_EXECUTION (ID_);
  214. alter table ACT_RU_EXECUTION
  215. add constraint ACT_FK_EXE_PROCDEF
  216. foreign key (PROC_DEF_ID_)
  217. references ACT_RE_PROCDEF (ID_);
  218. alter table ACT_RU_IDENTITYLINK
  219. add constraint ACT_FK_TSKASS_TASK
  220. foreign key (TASK_ID_)
  221. references ACT_RU_TASK (ID_);
  222. alter table ACT_RU_IDENTITYLINK
  223. add constraint ACT_FK_ATHRZ_PROCEDEF
  224. foreign key (PROC_DEF_ID_)
  225. references ACT_RE_PROCDEF(ID_);
  226. alter table ACT_RU_IDENTITYLINK
  227. add constraint ACT_FK_IDL_PROCINST
  228. foreign key (PROC_INST_ID_)
  229. references ACT_RU_EXECUTION (ID_);
  230. alter table ACT_RU_TASK
  231. add constraint ACT_FK_TASK_EXE
  232. foreign key (EXECUTION_ID_)
  233. references ACT_RU_EXECUTION (ID_);
  234. alter table ACT_RU_TASK
  235. add constraint ACT_FK_TASK_PROCINST
  236. foreign key (PROC_INST_ID_)
  237. references ACT_RU_EXECUTION (ID_);
  238. alter table ACT_RU_TASK
  239. add constraint ACT_FK_TASK_PROCDEF
  240. foreign key (PROC_DEF_ID_)
  241. references ACT_RE_PROCDEF (ID_);
  242. alter table ACT_RU_VARIABLE
  243. add constraint ACT_FK_VAR_EXE
  244. foreign key (EXECUTION_ID_)
  245. references ACT_RU_EXECUTION (ID_);
  246. alter table ACT_RU_VARIABLE
  247. add constraint ACT_FK_VAR_PROCINST
  248. foreign key (PROC_INST_ID_)
  249. references ACT_RU_EXECUTION(ID_);
  250. alter table ACT_RU_VARIABLE
  251. add constraint ACT_FK_VAR_BYTEARRAY
  252. foreign key (BYTEARRAY_ID_)
  253. references ACT_GE_BYTEARRAY (ID_);
  254. alter table ACT_RU_JOB
  255. add constraint ACT_FK_JOB_EXCEPTION
  256. foreign key (EXCEPTION_STACK_ID_)
  257. references ACT_GE_BYTEARRAY (ID_);
  258. alter table ACT_RU_EVENT_SUBSCR
  259. add constraint ACT_FK_EVENT_EXEC
  260. foreign key (EXECUTION_ID_)
  261. references ACT_RU_EXECUTION(ID_);
  262. alter table ACT_RE_MODEL
  263. add constraint ACT_FK_MODEL_SOURCE
  264. foreign key (EDITOR_SOURCE_VALUE_ID_)
  265. references ACT_GE_BYTEARRAY (ID_);
  266. alter table ACT_RE_MODEL
  267. add constraint ACT_FK_MODEL_SOURCE_EXTRA
  268. foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_)
  269. references ACT_GE_BYTEARRAY (ID_);
  270. alter table ACT_RE_MODEL
  271. add constraint ACT_FK_MODEL_DEPLOYMENT
  272. foreign key (DEPLOYMENT_ID_)
  273. references ACT_RE_DEPLOYMENT (ID_);
  274. alter table ACT_PROCDEF_INFO
  275. add constraint ACT_FK_INFO_JSON_BA
  276. foreign key (INFO_JSON_ID_)
  277. references ACT_GE_BYTEARRAY (ID_);
  278. alter table ACT_PROCDEF_INFO
  279. add constraint ACT_FK_INFO_PROCDEF
  280. foreign key (PROC_DEF_ID_)
  281. references ACT_RE_PROCDEF (ID_);
  282. alter table ACT_PROCDEF_INFO
  283. add constraint ACT_UNIQ_INFO_PROCDEF
  284. unique (PROC_DEF_ID_);