sqlserver.sql 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. create table ACT_GE_PROPERTY (
  2. NAME_ nvarchar(64),
  3. VALUE_ nvarchar(300),
  4. REV_ int,
  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_ nvarchar(64),
  15. REV_ int,
  16. NAME_ nvarchar(255),
  17. DEPLOYMENT_ID_ nvarchar(64),
  18. BYTES_ varbinary(max),
  19. GENERATED_ tinyint,
  20. primary key (ID_)
  21. );
  22. create table ACT_RE_DEPLOYMENT (
  23. ID_ nvarchar(64),
  24. NAME_ nvarchar(255),
  25. CATEGORY_ nvarchar(255),
  26. TENANT_ID_ nvarchar(255) default '',
  27. DEPLOY_TIME_ datetime,
  28. primary key (ID_)
  29. );
  30. create table ACT_RE_MODEL (
  31. ID_ nvarchar(64) not null,
  32. REV_ int,
  33. NAME_ nvarchar(255),
  34. KEY_ nvarchar(255),
  35. CATEGORY_ nvarchar(255),
  36. CREATE_TIME_ datetime,
  37. LAST_UPDATE_TIME_ datetime,
  38. VERSION_ int,
  39. META_INFO_ nvarchar(4000),
  40. DEPLOYMENT_ID_ nvarchar(64),
  41. EDITOR_SOURCE_VALUE_ID_ nvarchar(64),
  42. EDITOR_SOURCE_EXTRA_VALUE_ID_ nvarchar(64),
  43. TENANT_ID_ nvarchar(255) default '',
  44. primary key (ID_)
  45. );
  46. create table ACT_RU_EXECUTION (
  47. ID_ nvarchar(64),
  48. REV_ int,
  49. PROC_INST_ID_ nvarchar(64),
  50. BUSINESS_KEY_ nvarchar(255),
  51. PARENT_ID_ nvarchar(64),
  52. PROC_DEF_ID_ nvarchar(64),
  53. SUPER_EXEC_ nvarchar(64),
  54. ACT_ID_ nvarchar(255),
  55. IS_ACTIVE_ tinyint,
  56. IS_CONCURRENT_ tinyint,
  57. IS_SCOPE_ tinyint,
  58. IS_EVENT_SCOPE_ tinyint,
  59. SUSPENSION_STATE_ tinyint,
  60. CACHED_ENT_STATE_ int,
  61. TENANT_ID_ nvarchar(255) default '',
  62. NAME_ nvarchar(255),
  63. LOCK_TIME_ datetime,
  64. primary key (ID_)
  65. );
  66. create table ACT_RU_JOB (
  67. ID_ nvarchar(64) NOT NULL,
  68. REV_ int,
  69. TYPE_ nvarchar(255) NOT NULL,
  70. LOCK_EXP_TIME_ datetime,
  71. LOCK_OWNER_ nvarchar(255),
  72. EXCLUSIVE_ bit,
  73. EXECUTION_ID_ nvarchar(64),
  74. PROCESS_INSTANCE_ID_ nvarchar(64),
  75. PROC_DEF_ID_ nvarchar(64),
  76. RETRIES_ int,
  77. EXCEPTION_STACK_ID_ nvarchar(64),
  78. EXCEPTION_MSG_ nvarchar(4000),
  79. DUEDATE_ datetime NULL,
  80. REPEAT_ nvarchar(255),
  81. HANDLER_TYPE_ nvarchar(255),
  82. HANDLER_CFG_ nvarchar(4000),
  83. TENANT_ID_ nvarchar(255) default '',
  84. primary key (ID_)
  85. );
  86. create table ACT_RE_PROCDEF (
  87. ID_ nvarchar(64) not null,
  88. REV_ int,
  89. CATEGORY_ nvarchar(255),
  90. NAME_ nvarchar(255),
  91. KEY_ nvarchar(255) not null,
  92. VERSION_ int not null,
  93. DEPLOYMENT_ID_ nvarchar(64),
  94. RESOURCE_NAME_ nvarchar(4000),
  95. DGRM_RESOURCE_NAME_ nvarchar(4000),
  96. DESCRIPTION_ nvarchar(4000),
  97. HAS_START_FORM_KEY_ tinyint,
  98. HAS_GRAPHICAL_NOTATION_ tinyint,
  99. SUSPENSION_STATE_ tinyint,
  100. TENANT_ID_ nvarchar(255) default '',
  101. primary key (ID_)
  102. );
  103. create table ACT_RU_TASK (
  104. ID_ nvarchar(64),
  105. REV_ int,
  106. EXECUTION_ID_ nvarchar(64),
  107. PROC_INST_ID_ nvarchar(64),
  108. PROC_DEF_ID_ nvarchar(64),
  109. NAME_ nvarchar(255),
  110. PARENT_TASK_ID_ nvarchar(64),
  111. DESCRIPTION_ nvarchar(4000),
  112. TASK_DEF_KEY_ nvarchar(255),
  113. OWNER_ nvarchar(255),
  114. ASSIGNEE_ nvarchar(255),
  115. DELEGATION_ nvarchar(64),
  116. PRIORITY_ int,
  117. CREATE_TIME_ datetime,
  118. DUE_DATE_ datetime,
  119. CATEGORY_ nvarchar(255),
  120. SUSPENSION_STATE_ int,
  121. TENANT_ID_ nvarchar(255) default '',
  122. FORM_KEY_ nvarchar(255),
  123. primary key (ID_)
  124. );
  125. create table ACT_RU_IDENTITYLINK (
  126. ID_ nvarchar(64),
  127. REV_ int,
  128. GROUP_ID_ nvarchar(255),
  129. TYPE_ nvarchar(255),
  130. USER_ID_ nvarchar(255),
  131. TASK_ID_ nvarchar(64),
  132. PROC_INST_ID_ nvarchar(64),
  133. PROC_DEF_ID_ nvarchar(64),
  134. primary key (ID_)
  135. );
  136. create table ACT_RU_VARIABLE (
  137. ID_ nvarchar(64) not null,
  138. REV_ int,
  139. TYPE_ nvarchar(255) not null,
  140. NAME_ nvarchar(255) not null,
  141. EXECUTION_ID_ nvarchar(64),
  142. PROC_INST_ID_ nvarchar(64),
  143. TASK_ID_ nvarchar(64),
  144. BYTEARRAY_ID_ nvarchar(64),
  145. DOUBLE_ double precision,
  146. LONG_ numeric(19,0),
  147. TEXT_ nvarchar(4000),
  148. TEXT2_ nvarchar(4000),
  149. primary key (ID_)
  150. );
  151. create table ACT_RU_EVENT_SUBSCR (
  152. ID_ nvarchar(64) not null,
  153. REV_ int,
  154. EVENT_TYPE_ nvarchar(255) not null,
  155. EVENT_NAME_ nvarchar(255),
  156. EXECUTION_ID_ nvarchar(64),
  157. PROC_INST_ID_ nvarchar(64),
  158. ACTIVITY_ID_ nvarchar(64),
  159. CONFIGURATION_ nvarchar(255),
  160. CREATED_ datetime not null,
  161. PROC_DEF_ID_ nvarchar(64),
  162. TENANT_ID_ nvarchar(255) default '',
  163. primary key (ID_)
  164. );
  165. create table ACT_EVT_LOG (
  166. LOG_NR_ numeric(19,0) IDENTITY(1,1),
  167. TYPE_ nvarchar(64),
  168. PROC_DEF_ID_ nvarchar(64),
  169. PROC_INST_ID_ nvarchar(64),
  170. EXECUTION_ID_ nvarchar(64),
  171. TASK_ID_ nvarchar(64),
  172. TIME_STAMP_ datetime not null,
  173. USER_ID_ nvarchar(255),
  174. DATA_ varbinary(max),
  175. LOCK_OWNER_ nvarchar(255),
  176. LOCK_TIME_ datetime null,
  177. IS_PROCESSED_ tinyint default 0,
  178. primary key (LOG_NR_)
  179. );
  180. create table ACT_PROCDEF_INFO (
  181. ID_ nvarchar(64) not null,
  182. PROC_DEF_ID_ nvarchar(64) not null,
  183. REV_ int,
  184. INFO_JSON_ID_ nvarchar(64),
  185. primary key (ID_)
  186. );
  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_EXECUTION_PROC on ACT_RU_EXECUTION(PROC_DEF_ID_);
  195. create index ACT_IDX_EXECUTION_PARENT on ACT_RU_EXECUTION(PARENT_ID_);
  196. create index ACT_IDX_EXECUTION_SUPER on ACT_RU_EXECUTION(SUPER_EXEC_);
  197. create index ACT_IDX_EXECUTION_IDANDREV on ACT_RU_EXECUTION(ID_, REV_);
  198. create index ACT_IDX_VARIABLE_BA on ACT_RU_VARIABLE(BYTEARRAY_ID_);
  199. create index ACT_IDX_VARIABLE_EXEC on ACT_RU_VARIABLE(EXECUTION_ID_);
  200. create index ACT_IDX_VARIABLE_PROCINST on ACT_RU_VARIABLE(PROC_INST_ID_);
  201. create index ACT_IDX_IDENT_LNK_TASK on ACT_RU_IDENTITYLINK(TASK_ID_);
  202. create index ACT_IDX_IDENT_LNK_PROCINST on ACT_RU_IDENTITYLINK(PROC_INST_ID_);
  203. create index ACT_IDX_TASK_EXEC on ACT_RU_TASK(EXECUTION_ID_);
  204. create index ACT_IDX_TASK_PROCINST on ACT_RU_TASK(PROC_INST_ID_);
  205. create index ACT_IDX_EXEC_PROC_INST_ID on ACT_RU_EXECUTION(PROC_INST_ID_);
  206. create index ACT_IDX_TASK_PROC_DEF_ID on ACT_RU_TASK(PROC_DEF_ID_);
  207. create index ACT_IDX_EVENT_SUBSCR_EXEC_ID on ACT_RU_EVENT_SUBSCR(EXECUTION_ID_);
  208. create index ACT_IDX_JOB_EXCEPTION_STACK_ID on ACT_RU_JOB(EXCEPTION_STACK_ID_);
  209. create index ACT_IDX_INFO_PROCDEF on ACT_PROCDEF_INFO(PROC_DEF_ID_);
  210. alter table ACT_GE_BYTEARRAY
  211. add constraint ACT_FK_BYTEARR_DEPL
  212. foreign key (DEPLOYMENT_ID_)
  213. references ACT_RE_DEPLOYMENT (ID_);
  214. alter table ACT_RE_PROCDEF
  215. add constraint ACT_UNIQ_PROCDEF
  216. unique (KEY_,VERSION_, TENANT_ID_);
  217. alter table ACT_RU_EXECUTION
  218. add constraint ACT_FK_EXE_PARENT
  219. foreign key (PARENT_ID_)
  220. references ACT_RU_EXECUTION (ID_);
  221. alter table ACT_RU_EXECUTION
  222. add constraint ACT_FK_EXE_SUPER
  223. foreign key (SUPER_EXEC_)
  224. references ACT_RU_EXECUTION (ID_);
  225. alter table ACT_RU_EXECUTION
  226. add constraint ACT_FK_EXE_PROCDEF
  227. foreign key (PROC_DEF_ID_)
  228. references ACT_RE_PROCDEF (ID_);
  229. alter table ACT_RU_IDENTITYLINK
  230. add constraint ACT_FK_TSKASS_TASK
  231. foreign key (TASK_ID_)
  232. references ACT_RU_TASK (ID_);
  233. alter table ACT_RU_IDENTITYLINK
  234. add constraint ACT_FK_ATHRZ_PROCEDEF
  235. foreign key (PROC_DEF_ID_)
  236. references ACT_RE_PROCDEF (ID_);
  237. alter table ACT_RU_IDENTITYLINK
  238. add constraint ACT_FK_IDL_PROCINST
  239. foreign key (PROC_INST_ID_)
  240. references ACT_RU_EXECUTION (ID_);
  241. alter table ACT_RU_TASK
  242. add constraint ACT_FK_TASK_EXE
  243. foreign key (EXECUTION_ID_)
  244. references ACT_RU_EXECUTION (ID_);
  245. alter table ACT_RU_TASK
  246. add constraint ACT_FK_TASK_PROCINST
  247. foreign key (PROC_INST_ID_)
  248. references ACT_RU_EXECUTION (ID_);
  249. alter table ACT_RU_TASK
  250. add constraint ACT_FK_TASK_PROCDEF
  251. foreign key (PROC_DEF_ID_)
  252. references ACT_RE_PROCDEF (ID_);
  253. alter table ACT_RU_VARIABLE
  254. add constraint ACT_FK_VAR_EXE
  255. foreign key (EXECUTION_ID_)
  256. references ACT_RU_EXECUTION (ID_);
  257. alter table ACT_RU_VARIABLE
  258. add constraint ACT_FK_VAR_PROCINST
  259. foreign key (PROC_INST_ID_)
  260. references ACT_RU_EXECUTION(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. alter table ACT_RU_JOB
  266. add constraint ACT_FK_JOB_EXCEPTION
  267. foreign key (EXCEPTION_STACK_ID_)
  268. references ACT_GE_BYTEARRAY (ID_);
  269. alter table ACT_RU_EVENT_SUBSCR
  270. add constraint ACT_FK_EVENT_EXEC
  271. foreign key (EXECUTION_ID_)
  272. references ACT_RU_EXECUTION(ID_);
  273. alter table ACT_RE_MODEL
  274. add constraint ACT_FK_MODEL_SOURCE
  275. foreign key (EDITOR_SOURCE_VALUE_ID_)
  276. references ACT_GE_BYTEARRAY (ID_);
  277. alter table ACT_RE_MODEL
  278. add constraint ACT_FK_MODEL_SOURCE_EXTRA
  279. foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_)
  280. references ACT_GE_BYTEARRAY (ID_);
  281. alter table ACT_RE_MODEL
  282. add constraint ACT_FK_MODEL_DEPLOYMENT
  283. foreign key (DEPLOYMENT_ID_)
  284. references ACT_RE_DEPLOYMENT (ID_);
  285. alter table ACT_PROCDEF_INFO
  286. add constraint ACT_FK_INFO_JSON_BA
  287. foreign key (INFO_JSON_ID_)
  288. references ACT_GE_BYTEARRAY (ID_);
  289. alter table ACT_PROCDEF_INFO
  290. add constraint ACT_FK_INFO_PROCDEF
  291. foreign key (PROC_DEF_ID_)
  292. references ACT_RE_PROCDEF (ID_);
  293. alter table ACT_PROCDEF_INFO
  294. add constraint ACT_UNIQ_INFO_PROCDEF
  295. unique (PROC_DEF_ID_);
  296. create table ACT_HI_PROCINST (
  297. ID_ nvarchar(64) not null,
  298. PROC_INST_ID_ nvarchar(64) not null,
  299. BUSINESS_KEY_ nvarchar(255),
  300. PROC_DEF_ID_ nvarchar(64) not null,
  301. START_TIME_ datetime not null,
  302. END_TIME_ datetime,
  303. DURATION_ numeric(19,0),
  304. START_USER_ID_ nvarchar(255),
  305. START_ACT_ID_ nvarchar(255),
  306. END_ACT_ID_ nvarchar(255),
  307. SUPER_PROCESS_INSTANCE_ID_ nvarchar(64),
  308. DELETE_REASON_ nvarchar(4000),
  309. TENANT_ID_ nvarchar(255) default '',
  310. NAME_ nvarchar(255),
  311. primary key (ID_),
  312. unique (PROC_INST_ID_)
  313. );
  314. create table ACT_HI_ACTINST (
  315. ID_ nvarchar(64) not null,
  316. PROC_DEF_ID_ nvarchar(64) not null,
  317. PROC_INST_ID_ nvarchar(64) not null,
  318. EXECUTION_ID_ nvarchar(64) not null,
  319. ACT_ID_ nvarchar(255) not null,
  320. TASK_ID_ nvarchar(64),
  321. CALL_PROC_INST_ID_ nvarchar(64),
  322. ACT_NAME_ nvarchar(255),
  323. ACT_TYPE_ nvarchar(255) not null,
  324. ASSIGNEE_ nvarchar(255),
  325. START_TIME_ datetime not null,
  326. END_TIME_ datetime,
  327. DURATION_ numeric(19,0),
  328. TENANT_ID_ nvarchar(255) default '',
  329. primary key (ID_)
  330. );
  331. create table ACT_HI_TASKINST (
  332. ID_ nvarchar(64) not null,
  333. PROC_DEF_ID_ nvarchar(64),
  334. TASK_DEF_KEY_ nvarchar(255),
  335. PROC_INST_ID_ nvarchar(64),
  336. EXECUTION_ID_ nvarchar(64),
  337. NAME_ nvarchar(255),
  338. PARENT_TASK_ID_ nvarchar(64),
  339. DESCRIPTION_ nvarchar(4000),
  340. OWNER_ nvarchar(255),
  341. ASSIGNEE_ nvarchar(255),
  342. START_TIME_ datetime not null,
  343. CLAIM_TIME_ datetime,
  344. END_TIME_ datetime,
  345. DURATION_ numeric(19,0),
  346. DELETE_REASON_ nvarchar(4000),
  347. PRIORITY_ int,
  348. DUE_DATE_ datetime,
  349. FORM_KEY_ nvarchar(255),
  350. CATEGORY_ nvarchar(255),
  351. TENANT_ID_ nvarchar(255) default '',
  352. primary key (ID_)
  353. );
  354. create table ACT_HI_VARINST (
  355. ID_ nvarchar(64) not null,
  356. PROC_INST_ID_ nvarchar(64),
  357. EXECUTION_ID_ nvarchar(64),
  358. TASK_ID_ nvarchar(64),
  359. NAME_ nvarchar(255) not null,
  360. VAR_TYPE_ nvarchar(100),
  361. REV_ int,
  362. BYTEARRAY_ID_ nvarchar(64),
  363. DOUBLE_ double precision,
  364. LONG_ numeric(19,0),
  365. TEXT_ nvarchar(4000),
  366. TEXT2_ nvarchar(4000),
  367. CREATE_TIME_ datetime,
  368. LAST_UPDATED_TIME_ datetime,
  369. primary key (ID_)
  370. );
  371. create table ACT_HI_DETAIL (
  372. ID_ nvarchar(64) not null,
  373. TYPE_ nvarchar(255) not null,
  374. PROC_INST_ID_ nvarchar(64),
  375. EXECUTION_ID_ nvarchar(64),
  376. TASK_ID_ nvarchar(64),
  377. ACT_INST_ID_ nvarchar(64),
  378. NAME_ nvarchar(255) not null,
  379. VAR_TYPE_ nvarchar(255),
  380. REV_ int,
  381. TIME_ datetime not null,
  382. BYTEARRAY_ID_ nvarchar(64),
  383. DOUBLE_ double precision,
  384. LONG_ numeric(19,0),
  385. TEXT_ nvarchar(4000),
  386. TEXT2_ nvarchar(4000),
  387. primary key (ID_)
  388. );
  389. create table ACT_HI_COMMENT (
  390. ID_ nvarchar(64) not null,
  391. TYPE_ nvarchar(255),
  392. TIME_ datetime not null,
  393. USER_ID_ nvarchar(255),
  394. TASK_ID_ nvarchar(64),
  395. PROC_INST_ID_ nvarchar(64),
  396. ACTION_ nvarchar(255),
  397. MESSAGE_ nvarchar(4000),
  398. FULL_MSG_ varbinary(max),
  399. primary key (ID_)
  400. );
  401. create table ACT_HI_ATTACHMENT (
  402. ID_ nvarchar(64) not null,
  403. REV_ integer,
  404. USER_ID_ nvarchar(255),
  405. NAME_ nvarchar(255),
  406. DESCRIPTION_ nvarchar(4000),
  407. TYPE_ nvarchar(255),
  408. TASK_ID_ nvarchar(64),
  409. PROC_INST_ID_ nvarchar(64),
  410. URL_ nvarchar(4000),
  411. CONTENT_ID_ nvarchar(64),
  412. TIME_ datetime,
  413. primary key (ID_)
  414. );
  415. create table ACT_HI_IDENTITYLINK (
  416. ID_ nvarchar(64),
  417. GROUP_ID_ nvarchar(255),
  418. TYPE_ nvarchar(255),
  419. USER_ID_ nvarchar(255),
  420. TASK_ID_ nvarchar(64),
  421. PROC_INST_ID_ nvarchar(64),
  422. primary key (ID_)
  423. );
  424. create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_);
  425. create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_);
  426. create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_);
  427. create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_);
  428. create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_);
  429. create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_);
  430. create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_);
  431. create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_);
  432. create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_);
  433. create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_);
  434. create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_);
  435. create index ACT_IDX_HI_PROCVAR_TASK_ID on ACT_HI_VARINST(TASK_ID_);
  436. create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_);
  437. create index ACT_IDX_HI_ACT_INST_EXEC on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_);
  438. create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_);
  439. create index ACT_IDX_HI_IDENT_LNK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_);
  440. create index ACT_IDX_HI_IDENT_LNK_PROCINST on ACT_HI_IDENTITYLINK(PROC_INST_ID_);
  441. create index ACT_IDX_HI_TASK_INST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_);
  442. create table ACT_ID_GROUP (
  443. ID_ nvarchar(64),
  444. REV_ int,
  445. NAME_ nvarchar(255),
  446. TYPE_ nvarchar(255),
  447. primary key (ID_)
  448. );
  449. create table ACT_ID_MEMBERSHIP (
  450. USER_ID_ nvarchar(64),
  451. GROUP_ID_ nvarchar(64),
  452. primary key (USER_ID_, GROUP_ID_)
  453. );
  454. create table ACT_ID_USER (
  455. ID_ nvarchar(64),
  456. REV_ int,
  457. FIRST_ nvarchar(255),
  458. LAST_ nvarchar(255),
  459. EMAIL_ nvarchar(255),
  460. PWD_ nvarchar(255),
  461. PICTURE_ID_ nvarchar(64),
  462. primary key (ID_)
  463. );
  464. create table ACT_ID_INFO (
  465. ID_ nvarchar(64),
  466. REV_ int,
  467. USER_ID_ nvarchar(64),
  468. TYPE_ nvarchar(64),
  469. KEY_ nvarchar(255),
  470. VALUE_ nvarchar(255),
  471. PASSWORD_ varbinary(max),
  472. PARENT_ID_ nvarchar(255),
  473. primary key (ID_)
  474. );
  475. alter table ACT_ID_MEMBERSHIP
  476. add constraint ACT_FK_MEMB_GROUP
  477. foreign key (GROUP_ID_)
  478. references ACT_ID_GROUP (ID_);
  479. alter table ACT_ID_MEMBERSHIP
  480. add constraint ACT_FK_MEMB_USER
  481. foreign key (USER_ID_)
  482. references ACT_ID_USER (ID_);