CREATE TABLE JBPM4_DEPLOYMENT ( DBID_ NUMERIC (19, 0) NOT NULL, NAME_ VARCHAR (255), TIMESTAMP_ NUMERIC (19, 0), STATE_ VARCHAR (255), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_DEPLOYPROP ( DBID_ NUMERIC (19, 0) NOT NULL, DEPLOYMENT_ NUMERIC (19, 0), OBJNAME_ VARCHAR (255), KEY_ VARCHAR (255), STRINGVAL_ VARCHAR (255), LONGVAL_ NUMERIC (19, 0), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_EXECUTION ( DBID_ NUMERIC (19, 0) NOT NULL, CLASS_ VARCHAR (255) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, ACTIVITYNAME_ VARCHAR (255), PROCDEFID_ VARCHAR (255), HASVARS_ NUMERIC (1, 0), NAME_ VARCHAR (255), KEY_ VARCHAR (255), ID_ VARCHAR (255) UNIQUE, STATE_ VARCHAR (255), SUSPHISTSTATE_ VARCHAR (255), PRIORITY_ NUMERIC (10, 0), HISACTINST_ NUMERIC (19, 0), PARENT_ NUMERIC (19, 0), INSTANCE_ NUMERIC (19, 0), SUPEREXEC_ NUMERIC (19, 0), SUBPROCINST_ NUMERIC (19, 0), PARENT_IDX_ NUMERIC (10, 0), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_HIST_ACTINST ( DBID_ NUMERIC (19, 0) NOT NULL, CLASS_ VARCHAR (255) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, HPROCI_ NUMERIC (19, 0), TYPE_ VARCHAR (255), EXECUTION_ VARCHAR (255), ACTIVITY_NAME_ VARCHAR (255), START_ DATETIME, END_ DATETIME, DURATION_ NUMERIC (19, 0), TRANSITION_ VARCHAR (255), NEXTIDX_ NUMERIC (10, 0), HTASK_ NUMERIC (19, 0), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_HIST_DETAIL ( DBID_ NUMERIC (19, 0) NOT NULL, CLASS_ VARCHAR (255) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, USERID_ VARCHAR (255), TIME_ DATETIME, HPROCI_ NUMERIC (19, 0), HPROCIIDX_ NUMERIC (10, 0), HACTI_ NUMERIC (19, 0), HACTIIDX_ NUMERIC (10, 0), HTASK_ NUMERIC (19, 0), HTASKIDX_ NUMERIC (10, 0), HVAR_ NUMERIC (19, 0), HVARIDX_ NUMERIC (10, 0), MESSAGE_ VARCHAR (255), OLD_STR_ VARCHAR (255), NEW_STR_ VARCHAR (255), OLD_INT_ NUMERIC (10, 0), NEW_INT_ NUMERIC (10, 0), OLD_TIME_ DATETIME, NEW_TIME_ DATETIME, PARENT_ NUMERIC (19, 0), PARENT_IDX_ NUMERIC (10, 0), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_HIST_PROCINST ( DBID_ NUMERIC (19, 0) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, ID_ VARCHAR (255), PROCDEFID_ VARCHAR (255), KEY_ VARCHAR (255), START_ DATETIME, END_ DATETIME, DURATION_ NUMERIC (19, 0), STATE_ VARCHAR (255), ENDACTIVITY_ VARCHAR (255), NEXTIDX_ NUMERIC (10, 0), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_HIST_TASK ( DBID_ NUMERIC (19, 0) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, EXECUTION_ VARCHAR (255), OUTCOME_ VARCHAR (255), ASSIGNEE_ VARCHAR (255), PRIORITY_ NUMERIC (10, 0), STATE_ VARCHAR (255), CREATE_ DATETIME, END_ DATETIME, DURATION_ NUMERIC (19, 0), NEXTIDX_ NUMERIC (10, 0), SUPERTASK_ NUMERIC (19, 0), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_HIST_VAR ( DBID_ NUMERIC (19, 0) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, PROCINSTID_ VARCHAR (255), EXECUTIONID_ VARCHAR (255), VARNAME_ VARCHAR (255), VALUE_ VARCHAR (255), HPROCI_ NUMERIC (19, 0), HTASK_ NUMERIC (19, 0), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_ID_GROUP ( DBID_ NUMERIC (19, 0) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, ID_ VARCHAR (255), NAME_ VARCHAR (255), TYPE_ VARCHAR (255), PARENT_ NUMERIC (19, 0), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_ID_MEMBERSHIP ( DBID_ NUMERIC (19, 0) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, USER_ NUMERIC (19, 0), GROUP_ NUMERIC (19, 0), NAME_ VARCHAR (255), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_ID_USER ( DBID_ NUMERIC (19, 0) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, ID_ VARCHAR (255), PASSWORD_ VARCHAR (255), GIVENNAME_ VARCHAR (255), FAMILYNAME_ VARCHAR (255), BUSINESSEMAIL_ VARCHAR (255), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_JOB ( DBID_ NUMERIC (19, 0) NOT NULL, CLASS_ VARCHAR (255) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, DUEDATE_ DATETIME, STATE_ VARCHAR (255), ISEXCLUSIVE_ NUMERIC (1, 0), LOCKOWNER_ VARCHAR (255), LOCKEXPTIME_ DATETIME, EXCEPTION_ TEXT, RETRIES_ NUMERIC (10, 0), PROCESSINSTANCE_ NUMERIC (19, 0), EXECUTION_ NUMERIC (19, 0), CFG_ NUMERIC (19, 0), SIGNAL_ VARCHAR (255), EVENT_ VARCHAR (255), REPEAT_ VARCHAR (255), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_LOB ( DBID_ NUMERIC (19, 0) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, BLOB_VALUE_ image, DEPLOYMENT_ NUMERIC (19, 0), NAME_ TEXT, PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_PARTICIPATION ( DBID_ NUMERIC (19, 0) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, GROUPID_ VARCHAR (255), USERID_ VARCHAR (255), TYPE_ VARCHAR (255), TASK_ NUMERIC (19, 0), SWIMLANE_ NUMERIC (19, 0), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_PROPERTY ( KEY_ VARCHAR (255) NOT NULL, VERSION_ NUMERIC (10, 0) NOT NULL, VALUE_ VARCHAR (255), PRIMARY KEY (KEY_) ) ; CREATE TABLE JBPM4_SWIMLANE ( DBID_ NUMERIC (19, 0) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, NAME_ VARCHAR (255), ASSIGNEE_ VARCHAR (255), EXECUTION_ NUMERIC (19, 0), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_TASK ( DBID_ NUMERIC (19, 0) NOT NULL, CLASS_ CHAR(1) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, NAME_ VARCHAR (255), DESCR_ TEXT, STATE_ VARCHAR (255), SUSPHISTSTATE_ VARCHAR (255), ASSIGNEE_ VARCHAR (255), FORM_ VARCHAR (255), PRIORITY_ NUMERIC (10, 0), CREATE_ DATETIME, DUEDATE_ DATETIME, PROGRESS_ NUMERIC (10, 0), SIGNALLING_ NUMERIC (1, 0), EXECUTION_ID_ VARCHAR (255), ACTIVITY_NAME_ VARCHAR (255), HASVARS_ NUMERIC (1, 0), SUPERTASK_ NUMERIC (19, 0), EXECUTION_ NUMERIC (19, 0), PROCINST_ NUMERIC (19, 0), SWIMLANE_ NUMERIC (19, 0), TASKDEFNAME_ VARCHAR (255), PRIMARY KEY (DBID_) ) ; CREATE TABLE JBPM4_VARIABLE ( DBID_ NUMERIC (19, 0) NOT NULL, CLASS_ VARCHAR (255) NOT NULL, DBVERSION_ NUMERIC (10, 0) NOT NULL, KEY_ VARCHAR (255), CONVERTER_ VARCHAR (255), HIST_ NUMERIC (1, 0), EXECUTION_ NUMERIC (19, 0), TASK_ NUMERIC (19, 0), LOB_ NUMERIC (19, 0), DATE_VALUE_ DATETIME, DOUBLE_VALUE_ DOUBLE PRECISION, CLASSNAME_ VARCHAR (255), LONG_VALUE_ NUMERIC (19, 0), STRING_VALUE_ VARCHAR (255), TEXT_VALUE_ TEXT, EXESYS_ NUMERIC (19, 0), PRIMARY KEY (DBID_) ) ; CREATE INDEX IDX_DEPLPROP_DEPL ON JBPM4_DEPLOYPROP (DEPLOYMENT_) ; ALTER TABLE JBPM4_DEPLOYPROP ADD CONSTRAINT FK_DEPLPROP_DEPL FOREIGN KEY (DEPLOYMENT_) REFERENCES JBPM4_DEPLOYMENT ; CREATE INDEX IDX_EXEC_SUPEREXEC ON JBPM4_EXECUTION (SUPEREXEC_) ; CREATE INDEX IDX_EXEC_INSTANCE ON JBPM4_EXECUTION (INSTANCE_) ; CREATE INDEX IDX_EXEC_SUBPI ON JBPM4_EXECUTION (SUBPROCINST_) ; CREATE INDEX IDX_EXEC_PARENT ON JBPM4_EXECUTION (PARENT_) ; ALTER TABLE JBPM4_EXECUTION ADD CONSTRAINT FK_EXEC_PARENT FOREIGN KEY (PARENT_) REFERENCES JBPM4_EXECUTION ; ALTER TABLE JBPM4_EXECUTION ADD CONSTRAINT FK_EXEC_SUBPI FOREIGN KEY (SUBPROCINST_) REFERENCES JBPM4_EXECUTION ; ALTER TABLE JBPM4_EXECUTION ADD CONSTRAINT FK_EXEC_INSTANCE FOREIGN KEY (INSTANCE_) REFERENCES JBPM4_EXECUTION ; ALTER TABLE JBPM4_EXECUTION ADD CONSTRAINT FK_EXEC_SUPEREXEC FOREIGN KEY (SUPEREXEC_) REFERENCES JBPM4_EXECUTION ; CREATE INDEX IDX_HACTI_HPROCI ON JBPM4_HIST_ACTINST (HPROCI_) ; CREATE INDEX IDX_HTI_HTASK ON JBPM4_HIST_ACTINST (HTASK_) ; ALTER TABLE JBPM4_HIST_ACTINST ADD CONSTRAINT FK_HACTI_HPROCI FOREIGN KEY (HPROCI_) REFERENCES JBPM4_HIST_PROCINST ; ALTER TABLE JBPM4_HIST_ACTINST ADD CONSTRAINT FK_HTI_HTASK FOREIGN KEY (HTASK_) REFERENCES JBPM4_HIST_TASK ; CREATE INDEX IDX_HDET_HACTI ON JBPM4_HIST_DETAIL (HACTI_) ; CREATE INDEX IDX_HDET_HPROCI ON JBPM4_HIST_DETAIL (HPROCI_) ; CREATE INDEX IDX_HDET_HVAR ON JBPM4_HIST_DETAIL (HVAR_) ; CREATE INDEX IDX_HDET_HTASK ON JBPM4_HIST_DETAIL (HTASK_) ; ALTER TABLE JBPM4_HIST_DETAIL ADD CONSTRAINT FK_HDETAIL_HPROCI FOREIGN KEY (HPROCI_) REFERENCES JBPM4_HIST_PROCINST ; ALTER TABLE JBPM4_HIST_DETAIL ADD CONSTRAINT FK_HDETAIL_HACTI FOREIGN KEY (HACTI_) REFERENCES JBPM4_HIST_ACTINST ; ALTER TABLE JBPM4_HIST_DETAIL ADD CONSTRAINT FK_HDETAIL_HTASK FOREIGN KEY (HTASK_) REFERENCES JBPM4_HIST_TASK ; ALTER TABLE JBPM4_HIST_DETAIL ADD CONSTRAINT FK_HDETAIL_HVAR FOREIGN KEY (HVAR_) REFERENCES JBPM4_HIST_VAR ; CREATE INDEX IDX_HSUPERT_SUB ON JBPM4_HIST_TASK (SUPERTASK_) ; ALTER TABLE JBPM4_HIST_TASK ADD CONSTRAINT FK_HSUPERT_SUB FOREIGN KEY (SUPERTASK_) REFERENCES JBPM4_HIST_TASK ; CREATE INDEX IDX_HVAR_HPROCI ON JBPM4_HIST_VAR (HPROCI_) ; CREATE INDEX IDX_HVAR_HTASK ON JBPM4_HIST_VAR (HTASK_) ; ALTER TABLE JBPM4_HIST_VAR ADD CONSTRAINT FK_HVAR_HPROCI FOREIGN KEY (HPROCI_) REFERENCES JBPM4_HIST_PROCINST ; ALTER TABLE JBPM4_HIST_VAR ADD CONSTRAINT FK_HVAR_HTASK FOREIGN KEY (HTASK_) REFERENCES JBPM4_HIST_TASK ; CREATE INDEX IDX_GROUP_PARENT ON JBPM4_ID_GROUP (PARENT_) ; ALTER TABLE JBPM4_ID_GROUP ADD CONSTRAINT FK_GROUP_PARENT FOREIGN KEY (PARENT_) REFERENCES JBPM4_ID_GROUP ; CREATE INDEX IDX_MEM_USER ON JBPM4_ID_MEMBERSHIP (USER_) ; CREATE INDEX IDX_MEM_GROUP ON JBPM4_ID_MEMBERSHIP (GROUP_) ; ALTER TABLE JBPM4_ID_MEMBERSHIP ADD CONSTRAINT FK_MEM_GROUP FOREIGN KEY (GROUP_) REFERENCES JBPM4_ID_GROUP ; ALTER TABLE JBPM4_ID_MEMBERSHIP ADD CONSTRAINT FK_MEM_USER FOREIGN KEY (USER_) REFERENCES JBPM4_ID_USER ; CREATE INDEX IDX_JOBRETRIES ON JBPM4_JOB (RETRIES_) ; CREATE INDEX IDX_JOB_CFG ON JBPM4_JOB (CFG_) ; CREATE INDEX IDX_JOB_PRINST ON JBPM4_JOB (PROCESSINSTANCE_) ; CREATE INDEX IDX_JOB_EXE ON JBPM4_JOB (EXECUTION_) ; CREATE INDEX IDX_JOBLOCKEXP ON JBPM4_JOB (LOCKEXPTIME_) ; CREATE INDEX IDX_JOBDUEDATE ON JBPM4_JOB (DUEDATE_) ; ALTER TABLE JBPM4_JOB ADD CONSTRAINT FK_JOB_CFG FOREIGN KEY (CFG_) REFERENCES JBPM4_LOB ; CREATE INDEX IDX_LOB_DEPLOYMENT ON JBPM4_LOB (DEPLOYMENT_) ; ALTER TABLE JBPM4_LOB ADD CONSTRAINT FK_LOB_DEPLOYMENT FOREIGN KEY (DEPLOYMENT_) REFERENCES JBPM4_DEPLOYMENT ; CREATE INDEX IDX_PART_TASK ON JBPM4_PARTICIPATION (TASK_) ; ALTER TABLE JBPM4_PARTICIPATION ADD CONSTRAINT FK_PART_SWIMLANE FOREIGN KEY (SWIMLANE_) REFERENCES JBPM4_SWIMLANE ; ALTER TABLE JBPM4_PARTICIPATION ADD CONSTRAINT FK_PART_TASK FOREIGN KEY (TASK_) REFERENCES JBPM4_TASK ; CREATE INDEX IDX_SWIMLANE_EXEC ON JBPM4_SWIMLANE (EXECUTION_) ; ALTER TABLE JBPM4_SWIMLANE ADD CONSTRAINT FK_SWIMLANE_EXEC FOREIGN KEY (EXECUTION_) REFERENCES JBPM4_EXECUTION ; CREATE INDEX IDX_TASK_SUPERTASK ON JBPM4_TASK (SUPERTASK_) ; ALTER TABLE JBPM4_TASK ADD CONSTRAINT FK_TASK_SWIML FOREIGN KEY (SWIMLANE_) REFERENCES JBPM4_SWIMLANE ; ALTER TABLE JBPM4_TASK ADD CONSTRAINT FK_TASK_SUPERTASK FOREIGN KEY (SUPERTASK_) REFERENCES JBPM4_TASK ; CREATE INDEX IDX_VAR_EXESYS ON JBPM4_VARIABLE (EXESYS_) ; CREATE INDEX IDX_VAR_TASK ON JBPM4_VARIABLE (TASK_) ; CREATE INDEX IDX_VAR_EXECUTION ON JBPM4_VARIABLE (EXECUTION_) ; CREATE INDEX IDX_VAR_LOB ON JBPM4_VARIABLE (LOB_) ; ALTER TABLE JBPM4_VARIABLE ADD CONSTRAINT FK_VAR_LOB FOREIGN KEY (LOB_) REFERENCES JBPM4_LOB ; ALTER TABLE JBPM4_VARIABLE ADD CONSTRAINT FK_VAR_EXECUTION FOREIGN KEY (EXECUTION_) REFERENCES JBPM4_EXECUTION ; ALTER TABLE JBPM4_VARIABLE ADD CONSTRAINT FK_VAR_EXESYS FOREIGN KEY (EXESYS_) REFERENCES JBPM4_EXECUTION ; ALTER TABLE JBPM4_VARIABLE ADD CONSTRAINT FK_VAR_TASK FOREIGN KEY (TASK_) REFERENCES JBPM4_TASK ;