activiti.postgres.create.engine.sql 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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_ bytea,
  19. GENERATED_ boolean,
  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_ boolean,
  56. IS_CONCURRENT_ boolean,
  57. IS_SCOPE_ boolean,
  58. IS_EVENT_SCOPE_ boolean,
  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_ boolean,
  98. HAS_GRAPHICAL_NOTATION_ boolean,
  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),
  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 precision,
  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_ SERIAL PRIMARY KEY,
  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_ bytea,
  175. LOCK_OWNER_ varchar(255),
  176. LOCK_TIME_ timestamp null,
  177. IS_PROCESSED_ smallint 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_BYTEAR_DEPL on ACT_GE_BYTEARRAY(DEPLOYMENT_ID_);
  193. alter table ACT_GE_BYTEARRAY
  194. add constraint ACT_FK_BYTEARR_DEPL
  195. foreign key (DEPLOYMENT_ID_)
  196. references ACT_RE_DEPLOYMENT (ID_);
  197. alter table ACT_RE_PROCDEF
  198. add constraint ACT_UNIQ_PROCDEF
  199. unique (KEY_,VERSION_, TENANT_ID_);
  200. create index ACT_IDX_EXE_PROCINST on ACT_RU_EXECUTION(PROC_INST_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 (ID_);
  205. create index ACT_IDX_EXE_PARENT on ACT_RU_EXECUTION(PARENT_ID_);
  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. create index ACT_IDX_EXE_SUPER on ACT_RU_EXECUTION(SUPER_EXEC_);
  211. alter table ACT_RU_EXECUTION
  212. add constraint ACT_FK_EXE_SUPER
  213. foreign key (SUPER_EXEC_)
  214. references ACT_RU_EXECUTION (ID_);
  215. create index ACT_IDX_EXE_PROCDEF on ACT_RU_EXECUTION(PROC_DEF_ID_);
  216. alter table ACT_RU_EXECUTION
  217. add constraint ACT_FK_EXE_PROCDEF
  218. foreign key (PROC_DEF_ID_)
  219. references ACT_RE_PROCDEF (ID_);
  220. create index ACT_IDX_TSKASS_TASK on ACT_RU_IDENTITYLINK(TASK_ID_);
  221. alter table ACT_RU_IDENTITYLINK
  222. add constraint ACT_FK_TSKASS_TASK
  223. foreign key (TASK_ID_)
  224. references ACT_RU_TASK (ID_);
  225. create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_);
  226. alter table ACT_RU_IDENTITYLINK
  227. add constraint ACT_FK_ATHRZ_PROCEDEF
  228. foreign key (PROC_DEF_ID_)
  229. references ACT_RE_PROCDEF (ID_);
  230. create index ACT_IDX_IDL_PROCINST on ACT_RU_IDENTITYLINK(PROC_INST_ID_);
  231. alter table ACT_RU_IDENTITYLINK
  232. add constraint ACT_FK_IDL_PROCINST
  233. foreign key (PROC_INST_ID_)
  234. references ACT_RU_EXECUTION (ID_);
  235. create index ACT_IDX_TASK_EXEC on ACT_RU_TASK(EXECUTION_ID_);
  236. alter table ACT_RU_TASK
  237. add constraint ACT_FK_TASK_EXE
  238. foreign key (EXECUTION_ID_)
  239. references ACT_RU_EXECUTION (ID_);
  240. create index ACT_IDX_TASK_PROCINST on ACT_RU_TASK(PROC_INST_ID_);
  241. alter table ACT_RU_TASK
  242. add constraint ACT_FK_TASK_PROCINST
  243. foreign key (PROC_INST_ID_)
  244. references ACT_RU_EXECUTION (ID_);
  245. create index ACT_IDX_TASK_PROCDEF on ACT_RU_TASK(PROC_DEF_ID_);
  246. alter table ACT_RU_TASK
  247. add constraint ACT_FK_TASK_PROCDEF
  248. foreign key (PROC_DEF_ID_)
  249. references ACT_RE_PROCDEF (ID_);
  250. create index ACT_IDX_VAR_EXE on ACT_RU_VARIABLE(EXECUTION_ID_);
  251. alter table ACT_RU_VARIABLE
  252. add constraint ACT_FK_VAR_EXE
  253. foreign key (EXECUTION_ID_)
  254. references ACT_RU_EXECUTION (ID_);
  255. create index ACT_IDX_VAR_PROCINST on ACT_RU_VARIABLE(PROC_INST_ID_);
  256. alter table ACT_RU_VARIABLE
  257. add constraint ACT_FK_VAR_PROCINST
  258. foreign key (PROC_INST_ID_)
  259. references ACT_RU_EXECUTION(ID_);
  260. create index ACT_IDX_VAR_BYTEARRAY on ACT_RU_VARIABLE(BYTEARRAY_ID_);
  261. alter table ACT_RU_VARIABLE
  262. add constraint ACT_FK_VAR_BYTEARRAY
  263. foreign key (BYTEARRAY_ID_)
  264. references ACT_GE_BYTEARRAY (ID_);
  265. create index ACT_IDX_JOB_EXCEPTION on ACT_RU_JOB(EXCEPTION_STACK_ID_);
  266. alter table ACT_RU_JOB
  267. add constraint ACT_FK_JOB_EXCEPTION
  268. foreign key (EXCEPTION_STACK_ID_)
  269. references ACT_GE_BYTEARRAY (ID_);
  270. create index ACT_IDX_EVENT_SUBSCR on ACT_RU_EVENT_SUBSCR(EXECUTION_ID_);
  271. alter table ACT_RU_EVENT_SUBSCR
  272. add constraint ACT_FK_EVENT_EXEC
  273. foreign key (EXECUTION_ID_)
  274. references ACT_RU_EXECUTION(ID_);
  275. create index ACT_IDX_MODEL_SOURCE on ACT_RE_MODEL(EDITOR_SOURCE_VALUE_ID_);
  276. alter table ACT_RE_MODEL
  277. add constraint ACT_FK_MODEL_SOURCE
  278. foreign key (EDITOR_SOURCE_VALUE_ID_)
  279. references ACT_GE_BYTEARRAY (ID_);
  280. create index ACT_IDX_MODEL_SOURCE_EXTRA on ACT_RE_MODEL(EDITOR_SOURCE_EXTRA_VALUE_ID_);
  281. alter table ACT_RE_MODEL
  282. add constraint ACT_FK_MODEL_SOURCE_EXTRA
  283. foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_)
  284. references ACT_GE_BYTEARRAY (ID_);
  285. create index ACT_IDX_MODEL_DEPLOYMENT on ACT_RE_MODEL(DEPLOYMENT_ID_);
  286. alter table ACT_RE_MODEL
  287. add constraint ACT_FK_MODEL_DEPLOYMENT
  288. foreign key (DEPLOYMENT_ID_)
  289. references ACT_RE_DEPLOYMENT (ID_);
  290. create index ACT_IDX_PROCDEF_INFO_JSON on ACT_PROCDEF_INFO(INFO_JSON_ID_);
  291. alter table ACT_PROCDEF_INFO
  292. add constraint ACT_FK_INFO_JSON_BA
  293. foreign key (INFO_JSON_ID_)
  294. references ACT_GE_BYTEARRAY (ID_);
  295. create index ACT_IDX_PROCDEF_INFO_PROC on ACT_PROCDEF_INFO(PROC_DEF_ID_);
  296. alter table ACT_PROCDEF_INFO
  297. add constraint ACT_FK_INFO_PROCDEF
  298. foreign key (PROC_DEF_ID_)
  299. references ACT_RE_PROCDEF (ID_);
  300. alter table ACT_PROCDEF_INFO
  301. add constraint ACT_UNIQ_INFO_PROCDEF
  302. unique (PROC_DEF_ID_);