
    create table JBPM_ACTIVITY (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        PROCESS_ bigint,
        PROPS_ bigint,
        NAME_ varchar(255),
        DESCR_ varchar(255),
        HAS_VAR_DEF_ bit,
        HAS_TIMER_DEF_ bit,
        LOCAL_SCOPE_ bit,
        EXEC_ASYNC_ bit,
        SIGNAL_ASYNC_ bit,
        PREV_NEEDED_ bit,
        PARENT_ bigint,
        DEFTRANS_ bigint,
        BEHAV_DESCR_ bigint,
        BEHAV_CLASS_ varchar(255),
        BEHAV_ID_ bigint,
        ACTSPROCESS_ bigint,
        ACTSPROCESS_IDX_ integer,
        PARENT_IDX_ integer,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_ARGDESCRIPTOR (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        TYPENAME_ varchar(255),
        DESCRIPTOR_ bigint,
        OBJARG_DESCR_ bigint,
        OBJARG_DESCR_IDX_ integer,
        OPER_ bigint,
        OPER_IDX_ integer,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_COMMENT (
        DBID_ bigint not null auto_increment,
        CLASS_ varchar(255) not null,
        DBVERSION_ integer not null,
        USERID_ varchar(255),
        TIME_ datetime,
        MESSAGE_ varchar(255),
        PARENT_ bigint,
        PARENT_IDX_ integer,
        TASK_ bigint,
        TASK_IDX_ integer,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_DESCRIPTOR (
        DBID_ bigint not null auto_increment,
        CLASS_ varchar(255) not null,
        DBVERSION_ integer not null,
        NAME_ varchar(255),
        INIT_ char(1),
        TEXT_ varchar(255),
        DOUBLEVAL_ double precision,
        LONGVAL_ bigint,
        CLASSNAME_ varchar(255),
        METHOD_ varchar(255),
        BOOLVAL_ bit,
        FACTORYNAME_ varchar(255),
        FACTORYDESCR_ bigint,
        VALUEDESCR_ bigint,
        VALUEDESCR_IDX_ integer,
        KEYDESCR_ bigint,
        KEYDESCR_IDX_ integer,
        PROPS_ bigint,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_EVENT (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        PROCESSDEF_ bigint,
        PROPS_ bigint,
        NAME_ varchar(255),
        PROCESS_ bigint,
        ACT_ bigint,
        TRANSITION_ bigint,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_EXCEPTHNDLR (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        EXCEPT_CLASS_ varchar(255),
        TRANSACT_ bit,
        RETHROW_MASKED_ bit,
        TRANSITIONNAME_ varchar(255),
        NODENAME_ varchar(255),
        PROCESS_ bigint,
        PROCESS_IDX_ integer,
        ACT_ bigint,
        ACT_IDX_ integer,
        TRANSITION_ bigint,
        TRANSITION_IDX_ integer,
        EVENT_ bigint,
        EVENT_IDX_ integer,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_EXECUTION (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        ACT_ bigint,
        HASVARS_ bit,
        HASTIMERS_ bit,
        NAME_ varchar(255),
        KEY_ varchar(255),
        ID_ varchar(255) unique,
        STATE_ varchar(255),
        PRIORITY_ integer,
        HISACTINST_ bigint,
        PROCESS_ bigint,
        TRANSITION_ bigint,
        TRANSORIG_ bigint,
        PARENT_ bigint,
        INSTANCE_ bigint,
        SUPEREXEC_ bigint,
        PARENT_IDX_ integer,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_HIST_ACTINST (
        DBID_ bigint not null auto_increment,
        CLASS_ varchar(255) not null,
        DBVERSION_ integer not null,
        HPI_ varchar(255),
        ACTIVITY_ bigint,
        EXECUTION_ varchar(255),
        ACTIVITY_NAME_ varchar(255),
        START_ datetime,
        END_ datetime,
        DURATION_ bigint,
        TRANSITION_ varchar(255),
        ASSIGNEE_ varchar(255),
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_HIST_PROCINST (
        ID_ varchar(255) not null,
        DBVERSION_ integer not null,
        PROCDEFID_ varchar(255),
        KEY_ varchar(255),
        START_ datetime,
        END_ datetime,
        DURATION_ bigint,
        STATE_ varchar(255),
        ENDACTIVITY_ varchar(255),
        PROCDEF_ bigint,
        primary key (ID_)
    ) type=InnoDB;

    create table JBPM_JOB (
        DBID_ bigint not null auto_increment,
        CLASS_ varchar(255) not null,
        DBVERSION_ integer not null,
        DUEDATE_ datetime,
        ISSUSPENDED_ bit,
        ISEXCLUSIVE_ bit,
        LOCKOWNER_ varchar(255),
        LOCKEXPTIME_ datetime,
        INFO_ varchar(255),
        EXCEPTION_ text,
        RETRIES_ integer,
        PROCESSINSTANCE_ bigint,
        EXECUTION_ bigint,
        CMDDESCR_ bigint,
        SIGNAL_ varchar(255),
        NODE_ bigint,
        EVENT_ varchar(255),
        REPEAT_ varchar(255),
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_JPDL_ACTIVITY (
        DBID_ bigint not null auto_increment,
        CLASS_ varchar(255) not null,
        TEXT_ varchar(255),
        TEXT2_ varchar(255),
        EXCLDESCR_ bigint,
        ENDPI_ bit,
        ISUNIQ_ bit,
        PARAMDESCR_ bigint,
        JAVADESCR_ bigint,
        INVOPER_ bigint,
        TEXT3_ varchar(255),
        PARTSDESCR_ bigint,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_JPDL_EXECUTION (
        DBID_ bigint not null,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_JPDL_PROCDEF (
        DBID_ bigint not null,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_LOB (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        BLOB_VALUE_ longblob,
        BINARY_VALUE_ tinyblob,
        CLOB_VALUE_ text,
        TEXT_VALUE_ text,
        PROCESS_ bigint,
        NAME_ varchar(255),
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_OBJECTREF (
        DBID_ bigint not null auto_increment,
        CLASS_ varchar(255) not null,
        DBVERSION_ integer not null,
        OBJ_DESCR_ bigint,
        OBJ_CLASS_ varchar(255),
        OBJ_ID_ bigint,
        OBJ_EXPRESSION_ varchar(255),
        OBJ_EXPRLANG_ varchar(255),
        PROPAGATE_ bit,
        EVENT_ bigint,
        EVENT_IDX_ integer,
        EXHNDLR_ bigint,
        EXHNDLR_IDX_ integer,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_OPERATION (
        DBID_ bigint not null auto_increment,
        CLASS_ varchar(255) not null,
        DBVERSION_ integer not null,
        TEXT_ varchar(255),
        DESCR_ bigint,
        OBJOPER_DESCR_ bigint,
        OBJOPER_DESCR_IDX_ integer,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_PROCESS (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        PROPS_ bigint,
        NAME_ varchar(255),
        DESCR_ varchar(255),
        HAS_VAR_DEF_ bit,
        HAS_TIMER_DEF_ bit,
        KEY_ varchar(255),
        ID_ varchar(255) unique,
        PACKAGE_ varchar(255),
        VERSION_ integer,
        DEPLOYED_ datetime,
        INITIAL_ bigint,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_TIMERDEF (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        DUEDATEDESCR_ varchar(255),
        REPEAT_ varchar(255),
        ISEXCL_ bit,
        RETRIES_ integer,
        EVENT_ varchar(255),
        SIGNAL_ varchar(255),
        DUEDATE_ datetime,
        PROCESS_ bigint,
        ACT_ bigint,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_TRANSITION (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        PROCESS_ bigint,
        PROPS_ bigint,
        NAME_ varchar(255),
        DESCR_ varchar(255),
        SRC_ bigint,
        DEST_ bigint,
        COND_DESCR_ bigint,
        TAKEASYNC_ bit,
        DESTINATION_ bigint,
        IN_IDX_ integer,
        SOURCE_ bigint,
        OUT_IDX_ integer,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_VARIABLE (
        DBID_ bigint not null auto_increment,
        CLASS_ varchar(255) not null,
        DBVERSION_ integer not null,
        KEY_ varchar(255),
        QUERYTEXT_ varchar(255),
        CONVERTER_ varchar(255),
        PROCINST_ bigint,
        DATE_VALUE_ datetime,
        DOUBLE_VALUE_ double precision,
        LONG_VALUE_ bigint,
        STRING_VALUE_ varchar(255),
        LOB_ bigint,
        EXECUTION_ bigint,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_VARIABLEDEF (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        NAME_ varchar(255),
        TYPE_ varchar(255),
        INVAR_ varchar(255),
        INEXPR_ varchar(255),
        INDESCR_ bigint,
        OUTVAR_ varchar(255),
        OUTEXPR_ varchar(255),
        PROCESS_ bigint,
        PROCESS_IDX_ integer,
        ACT_ bigint,
        ACT_IDX_ integer,
        primary key (DBID_)
    ) type=InnoDB;

    create table JBPM_WIREPROPS (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        primary key (DBID_)
    ) type=InnoDB;

    create table ParticipantImpl (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        IDENTITYTYPE_ varchar(255),
        IDENTITYID_ varchar(255),
        PARTICIPATION_ varchar(255),
        TASK_ bigint,
        SWIMLANE_ bigint,
        primary key (DBID_)
    ) type=InnoDB;

    create table SwimlaneDefinitionImpl (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        NAME_ varchar(255),
        primary key (DBID_)
    ) type=InnoDB;

    create table SwimlaneImpl (
        DBID_ bigint not null auto_increment,
        DBVERSION_ integer not null,
        NAME_ varchar(255),
        ASSIGNEE_ varchar(255),
        SWIMLANEDEF_ bigint,
        primary key (DBID_)
    ) type=InnoDB;

    create table TaskDefinitionImpl (
        DBID_ bigint not null auto_increment,
        CLASS_ char(1) not null,
        DBVERSION_ integer not null,
        NAME_ varchar(255),
        DESCR_ varchar(255),
        PRIORITY_ integer,
        DUEDATE_ varchar(255),
        BLOCK_ bit,
        SIGNAL_ bit,
        ASSIGNEE_EXPR_ varchar(255),
        CANDIDATES_EXPR_ varchar(255),
        ASSIGNER_DESCR_ bigint,
        SWIMLANE_DEF_ bigint,
        TASKDEF_ bigint,
        TASKDEF_IDX_ integer,
        primary key (DBID_)
    ) type=InnoDB;

    create table TaskImpl (
        DBID_ bigint not null auto_increment,
        CLASS_ char(1) not null,
        DBVERSION_ integer not null,
        ID_ varchar(255) unique,
        NAME_ varchar(255),
        DESCR_ varchar(255),
        ASSIGNEE_ varchar(255),
        PRIORITY_ integer,
        CREATE_ datetime,
        DUEDATE_ datetime,
        PROGRESS_ integer,
        SUPERTASK_ bigint,
        EXECUTION_ bigint,
        SWIMLANE_ bigint,
        primary key (DBID_)
    ) type=InnoDB;

    create index IDX_ACT_DEFTRANS on JBPM_ACTIVITY (DEFTRANS_);

    create index IDX_ACT_PROCESS on JBPM_ACTIVITY (PROCESS_);

    create index IDX_NODE_BEHAV_DESCR on JBPM_ACTIVITY (BEHAV_DESCR_);

    create index IDX_ACTS_PROCESS on JBPM_ACTIVITY (ACTSPROCESS_);

    create index IDX_ACT_PROPS on JBPM_ACTIVITY (PROPS_);

    create index IDX_ACT_PARENT on JBPM_ACTIVITY (PARENT_);

    alter table JBPM_ACTIVITY 
        add index FK_NODE_BEHAV_DESCR (BEHAV_DESCR_), 
        add constraint FK_NODE_BEHAV_DESCR 
        foreign key (BEHAV_DESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    alter table JBPM_ACTIVITY 
        add index FK_ACT_PROCESS (PROCESS_), 
        add constraint FK_ACT_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS (DBID_);

    alter table JBPM_ACTIVITY 
        add index FK_ACT_DEFTRANS (DEFTRANS_), 
        add constraint FK_ACT_DEFTRANS 
        foreign key (DEFTRANS_) 
        references JBPM_TRANSITION (DBID_);

    alter table JBPM_ACTIVITY 
        add index FK_ACT_PARENT (PARENT_), 
        add constraint FK_ACT_PARENT 
        foreign key (PARENT_) 
        references JBPM_ACTIVITY (DBID_);

    alter table JBPM_ACTIVITY 
        add index FK_ACTS_PROCESS (ACTSPROCESS_), 
        add constraint FK_ACTS_PROCESS 
        foreign key (ACTSPROCESS_) 
        references JBPM_PROCESS (DBID_);

    alter table JBPM_ACTIVITY 
        add index FK_ACT_PROPS (PROPS_), 
        add constraint FK_ACT_PROPS 
        foreign key (PROPS_) 
        references JBPM_WIREPROPS (DBID_);

    create index IDX_ARGDESCR_DESCR on JBPM_ARGDESCRIPTOR (DESCRIPTOR_);

    create index IDX_OBJARG_DESCR on JBPM_ARGDESCRIPTOR (OBJARG_DESCR_);

    create index IDX_ARGDSCR_OPER on JBPM_ARGDESCRIPTOR (OPER_);

    alter table JBPM_ARGDESCRIPTOR 
        add index FK_ARGDSCR_OPER (OPER_), 
        add constraint FK_ARGDSCR_OPER 
        foreign key (OPER_) 
        references JBPM_OPERATION (DBID_);

    alter table JBPM_ARGDESCRIPTOR 
        add index FK_OBJARG_DESCR (OBJARG_DESCR_), 
        add constraint FK_OBJARG_DESCR 
        foreign key (OBJARG_DESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    alter table JBPM_ARGDESCRIPTOR 
        add index FK_ARGDESCR_DESCR (DESCRIPTOR_), 
        add constraint FK_ARGDESCR_DESCR 
        foreign key (DESCRIPTOR_) 
        references JBPM_DESCRIPTOR (DBID_);

    alter table JBPM_COMMENT 
        add index FK7BD9C13586A745AD (TASK_), 
        add constraint FK7BD9C13586A745AD 
        foreign key (TASK_) 
        references TaskImpl (DBID_);

    create index IDX_DESCR_VALDESCR on JBPM_DESCRIPTOR (VALUEDESCR_);

    create index IDX_DESCR_PROPS on JBPM_DESCRIPTOR (PROPS_);

    create index IDX_DESCR_ARG_REF on JBPM_DESCRIPTOR (FACTORYDESCR_);

    alter table JBPM_DESCRIPTOR 
        add index FK_DESCR_KEYDESCR (KEYDESCR_), 
        add constraint FK_DESCR_KEYDESCR 
        foreign key (KEYDESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    alter table JBPM_DESCRIPTOR 
        add index FK_DESCR_VALDESCR (VALUEDESCR_), 
        add constraint FK_DESCR_VALDESCR 
        foreign key (VALUEDESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    alter table JBPM_DESCRIPTOR 
        add index FK_DESCR_ARG_REF (FACTORYDESCR_), 
        add constraint FK_DESCR_ARG_REF 
        foreign key (FACTORYDESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    alter table JBPM_DESCRIPTOR 
        add index FK_DESCR_PROPS (PROPS_), 
        add constraint FK_DESCR_PROPS 
        foreign key (PROPS_) 
        references JBPM_WIREPROPS (DBID_);

    create index IDX_EVENT_PROCESS on JBPM_EVENT (PROCESS_);

    create index IDX_EVENT_PROPS on JBPM_EVENT (PROPS_);

    create index IDX_EVENT_TRANS on JBPM_EVENT (TRANSITION_);

    create index IDX_EVENT_ACT on JBPM_EVENT (ACT_);

    create index IDX_EVENT_PROCDEF on JBPM_EVENT (PROCESSDEF_);

    alter table JBPM_EVENT 
        add index FK_EVENT_PROCESS (PROCESS_), 
        add constraint FK_EVENT_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS (DBID_);

    alter table JBPM_EVENT 
        add index FK_EVENT_ACT (ACT_), 
        add constraint FK_EVENT_ACT 
        foreign key (ACT_) 
        references JBPM_ACTIVITY (DBID_);

    alter table JBPM_EVENT 
        add index FK_EVENT_PROCDEF (PROCESSDEF_), 
        add constraint FK_EVENT_PROCDEF 
        foreign key (PROCESSDEF_) 
        references JBPM_PROCESS (DBID_);

    alter table JBPM_EVENT 
        add index FK_EVENT_TRANS (TRANSITION_), 
        add constraint FK_EVENT_TRANS 
        foreign key (TRANSITION_) 
        references JBPM_TRANSITION (DBID_);

    alter table JBPM_EVENT 
        add index FK_EVENT_PROPS (PROPS_), 
        add constraint FK_EVENT_PROPS 
        foreign key (PROPS_) 
        references JBPM_WIREPROPS (DBID_);

    create index IDX_EXHDLR_EVENT on JBPM_EXCEPTHNDLR (EVENT_);

    create index IDX_EXHDLR_PROCESS on JBPM_EXCEPTHNDLR (PROCESS_);

    create index IDX_EXHDLR_ACT on JBPM_EXCEPTHNDLR (ACT_);

    create index IDX_EXHDLR_TRANS on JBPM_EXCEPTHNDLR (TRANSITION_);

    alter table JBPM_EXCEPTHNDLR 
        add index FK_EXHDLR_PROCESS (PROCESS_), 
        add constraint FK_EXHDLR_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS (DBID_);

    alter table JBPM_EXCEPTHNDLR 
        add index FK_EXHDLR_EVENT (EVENT_), 
        add constraint FK_EXHDLR_EVENT 
        foreign key (EVENT_) 
        references JBPM_EVENT (DBID_);

    alter table JBPM_EXCEPTHNDLR 
        add index FK_EXHDLR_ACT (ACT_), 
        add constraint FK_EXHDLR_ACT 
        foreign key (ACT_) 
        references JBPM_ACTIVITY (DBID_);

    alter table JBPM_EXCEPTHNDLR 
        add index FK_EXHDLR_TRANS (TRANSITION_), 
        add constraint FK_EXHDLR_TRANS 
        foreign key (TRANSITION_) 
        references JBPM_TRANSITION (DBID_);

    create index IDX_EXEC_TRANSORIG on JBPM_EXECUTION (TRANSORIG_);

    create index IDX_EXEC_PROCESS on JBPM_EXECUTION (PROCESS_);

    create index IDX_EXEC_SUPEREXEC on JBPM_EXECUTION (SUPEREXEC_);

    create index IDX_EXEC_INSTANCE on JBPM_EXECUTION (INSTANCE_);

    create index IDX_EXEC_ACT on JBPM_EXECUTION (ACT_);

    create index IDX_EXEC_PARENT on JBPM_EXECUTION (PARENT_);

    alter table JBPM_EXECUTION 
        add index FK_EXEC_PROCESS (PROCESS_), 
        add constraint FK_EXEC_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS (DBID_);

    alter table JBPM_EXECUTION 
        add index FK_EXEC_ACT (ACT_), 
        add constraint FK_EXEC_ACT 
        foreign key (ACT_) 
        references JBPM_ACTIVITY (DBID_);

    alter table JBPM_EXECUTION 
        add index FK_EXEC_PARENT (PARENT_), 
        add constraint FK_EXEC_PARENT 
        foreign key (PARENT_) 
        references JBPM_EXECUTION (DBID_);

    alter table JBPM_EXECUTION 
        add index FK_EXEC_INSTANCE (INSTANCE_), 
        add constraint FK_EXEC_INSTANCE 
        foreign key (INSTANCE_) 
        references JBPM_EXECUTION (DBID_);

    alter table JBPM_EXECUTION 
        add index FK_EXEC_TRANSORIG (TRANSORIG_), 
        add constraint FK_EXEC_TRANSORIG 
        foreign key (TRANSORIG_) 
        references JBPM_ACTIVITY (DBID_);

    alter table JBPM_EXECUTION 
        add index FK_EXEC_SUPEREXEC (SUPEREXEC_), 
        add constraint FK_EXEC_SUPEREXEC 
        foreign key (SUPEREXEC_) 
        references JBPM_EXECUTION (DBID_);

    alter table JBPM_EXECUTION 
        add index FK4837C6E47026E1F (TRANSITION_), 
        add constraint FK4837C6E47026E1F 
        foreign key (TRANSITION_) 
        references JBPM_TRANSITION (DBID_);

    create index IDX_HISTAI_ACT on JBPM_HIST_ACTINST (ACTIVITY_);

    create index IDX_HAI_HPI on JBPM_HIST_ACTINST (HPI_);

    alter table JBPM_HIST_ACTINST 
        add index FK_HISTAI_ACT (ACTIVITY_), 
        add constraint FK_HISTAI_ACT 
        foreign key (ACTIVITY_) 
        references JBPM_ACTIVITY (DBID_);

    alter table JBPM_HIST_ACTINST 
        add index FK_HAI_HPI (HPI_), 
        add constraint FK_HAI_HPI 
        foreign key (HPI_) 
        references JBPM_HIST_PROCINST (ID_);

    create index IDX_HISTPI_PROCDEF on JBPM_HIST_PROCINST (PROCDEF_);

    alter table JBPM_HIST_PROCINST 
        add index FK_HISTPI_PROCDEF (PROCDEF_), 
        add constraint FK_HISTPI_PROCDEF 
        foreign key (PROCDEF_) 
        references JBPM_PROCESS (DBID_);

    create index IDX_JOBRETRIES on JBPM_JOB (RETRIES_);

    create index IDX_JOB_CMDDESCR on JBPM_JOB (CMDDESCR_);

    create index IDX_JOB_PRINST on JBPM_JOB (PROCESSINSTANCE_);

    create index IDX_JOB_EXE on JBPM_JOB (EXECUTION_);

    create index IDX_JOBLOCKEXP on JBPM_JOB (LOCKEXPTIME_);

    create index IDX_JOBDUEDATE on JBPM_JOB (DUEDATE_);

    alter table JBPM_JOB 
        add index FK_JOB_NODE (NODE_), 
        add constraint FK_JOB_NODE 
        foreign key (NODE_) 
        references JBPM_ACTIVITY (DBID_);

    alter table JBPM_JOB 
        add index FK_JOB_PRINST (PROCESSINSTANCE_), 
        add constraint FK_JOB_PRINST 
        foreign key (PROCESSINSTANCE_) 
        references JBPM_EXECUTION (DBID_);

    alter table JBPM_JOB 
        add index FK_TMR_EXECUTION (EXECUTION_), 
        add constraint FK_TMR_EXECUTION 
        foreign key (EXECUTION_) 
        references JBPM_EXECUTION (DBID_);

    alter table JBPM_JOB 
        add index FK_JOB_CMDDESCR (CMDDESCR_), 
        add constraint FK_JOB_CMDDESCR 
        foreign key (CMDDESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    create index IDX_ACT_JAVADESCR on JBPM_JPDL_ACTIVITY (JAVADESCR_);

    create index IDX_ACT_EXCLDESCR on JBPM_JPDL_ACTIVITY (EXCLDESCR_);

    create index IDX_ACT_PARAMDESCR on JBPM_JPDL_ACTIVITY (PARAMDESCR_);

    create index IDX_ACT_INVKOPER on JBPM_JPDL_ACTIVITY (INVOPER_);

    create index IDX_ACT_PARTSDESCR on JBPM_JPDL_ACTIVITY (PARTSDESCR_);

    alter table JBPM_JPDL_ACTIVITY 
        add index FK_ACT_EXCLDESCR (EXCLDESCR_), 
        add constraint FK_ACT_EXCLDESCR 
        foreign key (EXCLDESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    alter table JBPM_JPDL_ACTIVITY 
        add index FK_ACT_JAVADESCR (JAVADESCR_), 
        add constraint FK_ACT_JAVADESCR 
        foreign key (JAVADESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    alter table JBPM_JPDL_ACTIVITY 
        add index FK_ACT_PARTSDESCR (PARTSDESCR_), 
        add constraint FK_ACT_PARTSDESCR 
        foreign key (PARTSDESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    alter table JBPM_JPDL_ACTIVITY 
        add index FK_ACT_INVKOPER (INVOPER_), 
        add constraint FK_ACT_INVKOPER 
        foreign key (INVOPER_) 
        references JBPM_OPERATION (DBID_);

    alter table JBPM_JPDL_ACTIVITY 
        add index FK_ACT_PARAMDESCR (PARAMDESCR_), 
        add constraint FK_ACT_PARAMDESCR 
        foreign key (PARAMDESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    alter table JBPM_JPDL_EXECUTION 
        add index FKA5B37C91F3DBDB5E (DBID_), 
        add constraint FKA5B37C91F3DBDB5E 
        foreign key (DBID_) 
        references JBPM_EXECUTION (DBID_);

    alter table JBPM_JPDL_PROCDEF 
        add index FK4D2898A820C24C68 (DBID_), 
        add constraint FK4D2898A820C24C68 
        foreign key (DBID_) 
        references JBPM_PROCESS (DBID_);

    create index IDX_LOB_PROCESS on JBPM_LOB (PROCESS_);

    alter table JBPM_LOB 
        add index FK_LOB_PROCESS (PROCESS_), 
        add constraint FK_LOB_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS (DBID_);

    create index IDX_OBJREF_EXHNDLR on JBPM_OBJECTREF (EXHNDLR_);

    create index IDX_OBJREF_EVENT on JBPM_OBJECTREF (OBJ_DESCR_, EVENT_);

    alter table JBPM_OBJECTREF 
        add index FK_OBJECTREF_EVENT (EVENT_), 
        add constraint FK_OBJECTREF_EVENT 
        foreign key (EVENT_) 
        references JBPM_EVENT (DBID_);

    alter table JBPM_OBJECTREF 
        add index FK_OBJREF_EVENT (OBJ_DESCR_), 
        add constraint FK_OBJREF_EVENT 
        foreign key (OBJ_DESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    alter table JBPM_OBJECTREF 
        add index FK_OBJREF_EXHNDLR (EXHNDLR_), 
        add constraint FK_OBJREF_EXHNDLR 
        foreign key (EXHNDLR_) 
        references JBPM_EXCEPTHNDLR (DBID_);

    create index IDX_OBJOPER_DESCR on JBPM_OPERATION (OBJOPER_DESCR_);

    create index IDX_OPER_DESC on JBPM_OPERATION (DESCR_);

    alter table JBPM_OPERATION 
        add index FK_OBJOPER_DESCR (OBJOPER_DESCR_), 
        add constraint FK_OBJOPER_DESCR 
        foreign key (OBJOPER_DESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    alter table JBPM_OPERATION 
        add index FK_OPER_DESC (DESCR_), 
        add constraint FK_OPER_DESC 
        foreign key (DESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    create index IDX_PROCDEF_PROPS on JBPM_PROCESS (PROPS_);

    create index IDX_PROCDEF_INIT on JBPM_PROCESS (INITIAL_);

    alter table JBPM_PROCESS 
        add index FK_PROCDEF_INITIAL (INITIAL_), 
        add constraint FK_PROCDEF_INITIAL 
        foreign key (INITIAL_) 
        references JBPM_ACTIVITY (DBID_);

    alter table JBPM_PROCESS 
        add index FK_PROCDEF_PROPS (PROPS_), 
        add constraint FK_PROCDEF_PROPS 
        foreign key (PROPS_) 
        references JBPM_WIREPROPS (DBID_);

    create index IDX_TMRDEF_PROCESS on JBPM_TIMERDEF (PROCESS_);

    create index IDX_TMRDEF_ACT on JBPM_TIMERDEF (ACT_);

    alter table JBPM_TIMERDEF 
        add index FK_TMRDEF_PROCESS (PROCESS_), 
        add constraint FK_TMRDEF_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS (DBID_);

    alter table JBPM_TIMERDEF 
        add index FK_TMRDEF_ACT (ACT_), 
        add constraint FK_TMRDEF_ACT 
        foreign key (ACT_) 
        references JBPM_ACTIVITY (DBID_);

    create index IDX_TRANS_DST on JBPM_TRANSITION (DEST_);

    create index IDX_TRANS_COND on JBPM_TRANSITION (COND_DESCR_);

    create index IDX_TRANS_SRC on JBPM_TRANSITION (SRC_);

    create index IDX_TRANS_PROPS on JBPM_TRANSITION (PROPS_);

    create index IDX_TRANS_PROCDEF on JBPM_TRANSITION (PROCESS_);

    alter table JBPM_TRANSITION 
        add index FK_TRANS_PROCDEF (PROCESS_), 
        add constraint FK_TRANS_PROCDEF 
        foreign key (PROCESS_) 
        references JBPM_PROCESS (DBID_);

    alter table JBPM_TRANSITION 
        add index FK_TRANS_COND (COND_DESCR_), 
        add constraint FK_TRANS_COND 
        foreign key (COND_DESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    alter table JBPM_TRANSITION 
        add index FK_TRANS_DST (DEST_), 
        add constraint FK_TRANS_DST 
        foreign key (DEST_) 
        references JBPM_ACTIVITY (DBID_);

    alter table JBPM_TRANSITION 
        add index FK_TRANS_SRC (SRC_), 
        add constraint FK_TRANS_SRC 
        foreign key (SRC_) 
        references JBPM_ACTIVITY (DBID_);

    alter table JBPM_TRANSITION 
        add index FK4FF269FD5B03CD3 (SOURCE_), 
        add constraint FK4FF269FD5B03CD3 
        foreign key (SOURCE_) 
        references JBPM_ACTIVITY (DBID_);

    alter table JBPM_TRANSITION 
        add index FK4FF269FFC35DF40 (DESTINATION_), 
        add constraint FK4FF269FFC35DF40 
        foreign key (DESTINATION_) 
        references JBPM_ACTIVITY (DBID_);

    alter table JBPM_TRANSITION 
        add index FK_TRANS_PROPS (PROPS_), 
        add constraint FK_TRANS_PROPS 
        foreign key (PROPS_) 
        references JBPM_WIREPROPS (DBID_);

    create index IDX_VAR_PROCINST on JBPM_VARIABLE (PROCINST_);

    create index IDX_VAR_EXECUTION on JBPM_VARIABLE (EXECUTION_);

    create index IDX_VAR_LOB on JBPM_VARIABLE (LOB_);

    alter table JBPM_VARIABLE 
        add index FK_VAR_PROCINST (PROCINST_), 
        add constraint FK_VAR_PROCINST 
        foreign key (PROCINST_) 
        references JBPM_EXECUTION (DBID_);

    alter table JBPM_VARIABLE 
        add index FK_VAR_LOB (LOB_), 
        add constraint FK_VAR_LOB 
        foreign key (LOB_) 
        references JBPM_LOB (DBID_);

    alter table JBPM_VARIABLE 
        add index FK_VAR_EXECUTION (EXECUTION_), 
        add constraint FK_VAR_EXECUTION 
        foreign key (EXECUTION_) 
        references JBPM_EXECUTION (DBID_);

    create index IDX_VARDEF_INDES on JBPM_VARIABLEDEF (INDESCR_);

    create index IDX_VARDEF_ACT on JBPM_VARIABLEDEF (ACT_);

    create index IDX_VARDEF_PROCESS on JBPM_VARIABLEDEF (PROCESS_);

    alter table JBPM_VARIABLEDEF 
        add index FK_VARDEF_PROCESS (PROCESS_), 
        add constraint FK_VARDEF_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS (DBID_);

    alter table JBPM_VARIABLEDEF 
        add index FK_VARDEF_ACT (ACT_), 
        add constraint FK_VARDEF_ACT 
        foreign key (ACT_) 
        references JBPM_ACTIVITY (DBID_);

    alter table JBPM_VARIABLEDEF 
        add index FK_VARDEF_INDES (INDESCR_), 
        add constraint FK_VARDEF_INDES 
        foreign key (INDESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    create index IDX_PART_TASK on ParticipantImpl (TASK_);

    alter table ParticipantImpl 
        add index FK_PART_SWIMLANE (SWIMLANE_), 
        add constraint FK_PART_SWIMLANE 
        foreign key (SWIMLANE_) 
        references SwimlaneImpl (DBID_);

    alter table ParticipantImpl 
        add index FK_PART_TASK (TASK_), 
        add constraint FK_PART_TASK 
        foreign key (TASK_) 
        references TaskImpl (DBID_);

    alter table SwimlaneImpl 
        add index FK_SWIMLANE_DEF (SWIMLANEDEF_), 
        add constraint FK_SWIMLANE_DEF 
        foreign key (SWIMLANEDEF_) 
        references SwimlaneDefinitionImpl (DBID_);

    create index IDX_TSK_SWIML_DEF on TaskDefinitionImpl (SWIMLANE_DEF_);

    create index IDX_TSK_ASIG_DESCR on TaskDefinitionImpl (ASSIGNER_DESCR_);

    alter table TaskDefinitionImpl 
        add index FK_TSK_SWIML_DEF (SWIMLANE_DEF_), 
        add constraint FK_TSK_SWIML_DEF 
        foreign key (SWIMLANE_DEF_) 
        references SwimlaneDefinitionImpl (DBID_);

    alter table TaskDefinitionImpl 
        add index FK7E595B18496CBE65 (TASKDEF_), 
        add constraint FK7E595B18496CBE65 
        foreign key (TASKDEF_) 
        references TaskDefinitionImpl (DBID_);

    alter table TaskDefinitionImpl 
        add index FK_TSK_ASIG_DESCR (ASSIGNER_DESCR_), 
        add constraint FK_TSK_ASIG_DESCR 
        foreign key (ASSIGNER_DESCR_) 
        references JBPM_DESCRIPTOR (DBID_);

    create index IDX_TASK_SUPERTASK on TaskImpl (SUPERTASK_);

    alter table TaskImpl 
        add index FK_TASK_SWIML (SWIMLANE_), 
        add constraint FK_TASK_SWIML 
        foreign key (SWIMLANE_) 
        references SwimlaneImpl (DBID_);

    alter table TaskImpl 
        add index FK_TASK_EXEC (EXECUTION_), 
        add constraint FK_TASK_EXEC 
        foreign key (EXECUTION_) 
        references JBPM_EXECUTION (DBID_);

    alter table TaskImpl 
        add index FK_TASK_SUPERTASK (SUPERTASK_), 
        add constraint FK_TASK_SUPERTASK 
        foreign key (SUPERTASK_) 
        references TaskImpl (DBID_);
