text: create table ACT_GE_PROPERTY (
      NAME_ NVARCHAR2(64),
      VALUE_ NVARCHAR2(300),
      REV_ INTEGER,
      primary key (NAME_)
  );
  
  create table ACT_GE_BYTEARRAY (
      ID_ NVARCHAR2(64),
      REV_ INTEGER,
      NAME_ NVARCHAR2(255),
      DEPLOYMENT_ID_ NVARCHAR2(64),
      BYTES_ BLOB,
      GENERATED_ NUMBER(1,0) CHECK (GENERATED_ IN (1,0)),
      primary key (ID_)
  );
  
  insert into ACT_GE_PROPERTY
  values ('common.schema.version', '6.7.1.0', 1);
  
  insert into ACT_GE_PROPERTY
  values ('next.dbid', '1', 1);
  
  
  create table ACT_RU_ENTITYLINK (
      ID_ NVARCHAR2(64),
      REV_ INTEGER,
      CREATE_TIME_ TIMESTAMP(6),
      LINK_TYPE_ NVARCHAR2(255),
      SCOPE_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      PARENT_ELEMENT_ID_ NVARCHAR2(255),
      REF_SCOPE_ID_ NVARCHAR2(255),
      REF_SCOPE_TYPE_ NVARCHAR2(255),
      REF_SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      ROOT_SCOPE_ID_ NVARCHAR2(255),
      ROOT_SCOPE_TYPE_ NVARCHAR2(255),
      HIERARCHY_TYPE_ NVARCHAR2(255),
      primary key (ID_)
  );
  
  create index ACT_IDX_ENT_LNK_SCOPE on ACT_RU_ENTITYLINK(SCOPE_ID_, SCOPE_TYPE_, LINK_TYPE_);
  create index ACT_IDX_ENT_LNK_ROOT_SCOPE on ACT_RU_ENTITYLINK(ROOT_SCOPE_ID_, ROOT_SCOPE_TYPE_, LINK_TYPE_);
  create index ACT_IDX_ENT_LNK_SCOPE_DEF on ACT_RU_ENTITYLINK(SCOPE_DEFINITION_ID_, SCOPE_TYPE_, LINK_TYPE_);
  
  insert into ACT_GE_PROPERTY values ('entitylink.schema.version', '6.7.1.0', 1);
  
  create table ACT_HI_ENTITYLINK (
      ID_ NVARCHAR2(64),
      LINK_TYPE_ NVARCHAR2(255),
      CREATE_TIME_ TIMESTAMP(6),
      SCOPE_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      PARENT_ELEMENT_ID_ NVARCHAR2(255),
      REF_SCOPE_ID_ NVARCHAR2(255),
      REF_SCOPE_TYPE_ NVARCHAR2(255),
      REF_SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      ROOT_SCOPE_ID_ NVARCHAR2(255),
      ROOT_SCOPE_TYPE_ NVARCHAR2(255),
      HIERARCHY_TYPE_ NVARCHAR2(255),
      primary key (ID_)
  );
  
  create index ACT_IDX_HI_ENT_LNK_SCOPE on ACT_HI_ENTITYLINK(SCOPE_ID_, SCOPE_TYPE_, LINK_TYPE_);
  create index ACT_IDX_HI_ENT_LNK_ROOT_SCOPE on ACT_HI_ENTITYLINK(ROOT_SCOPE_ID_, ROOT_SCOPE_TYPE_, LINK_TYPE_);
  create index ACT_IDX_HI_ENT_LNK_SCOPE_DEF on ACT_HI_ENTITYLINK(SCOPE_DEFINITION_ID_, SCOPE_TYPE_, LINK_TYPE_);
  
  
  create table ACT_RU_IDENTITYLINK (
      ID_ NVARCHAR2(64),
      REV_ INTEGER,
      GROUP_ID_ NVARCHAR2(255),
      TYPE_ NVARCHAR2(255),
      USER_ID_ NVARCHAR2(255),
      TASK_ID_ NVARCHAR2(64),
      PROC_INST_ID_ NVARCHAR2(64),
      PROC_DEF_ID_ NVARCHAR2(64),
      SCOPE_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      primary key (ID_)
  );
  
  create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_);
  create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_);
  create index ACT_IDX_IDENT_LNK_SCOPE on ACT_RU_IDENTITYLINK(SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_IDENT_LNK_SUB_SCOPE on ACT_RU_IDENTITYLINK(SUB_SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_IDENT_LNK_SCOPE_DEF on ACT_RU_IDENTITYLINK(SCOPE_DEFINITION_ID_, SCOPE_TYPE_);
  
  insert into ACT_GE_PROPERTY values ('identitylink.schema.version', '6.7.1.0', 1);
  
  create table ACT_HI_IDENTITYLINK (
      ID_ NVARCHAR2(64),
      GROUP_ID_ NVARCHAR2(255),
      TYPE_ NVARCHAR2(255),
      USER_ID_ NVARCHAR2(255),
      TASK_ID_ NVARCHAR2(64),
      CREATE_TIME_ TIMESTAMP(6),
      PROC_INST_ID_ NVARCHAR2(64),
      SCOPE_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      primary key (ID_)
  );
  
  create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_);
  create index ACT_IDX_HI_IDENT_LNK_SCOPE on ACT_HI_IDENTITYLINK(SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_HI_IDENT_LNK_SUB_SCOPE on ACT_HI_IDENTITYLINK(SUB_SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_HI_IDENT_LNK_SCOPE_DEF on ACT_HI_IDENTITYLINK(SCOPE_DEFINITION_ID_, SCOPE_TYPE_);
  
  
  create table ACT_RU_JOB (
      ID_ NVARCHAR2(64) NOT NULL,
      REV_ INTEGER,
      CATEGORY_ NVARCHAR2(255),
      TYPE_ NVARCHAR2(255) NOT NULL,
      LOCK_EXP_TIME_ TIMESTAMP(6),
      LOCK_OWNER_ NVARCHAR2(255),
      EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)),
      EXECUTION_ID_ NVARCHAR2(64),
      PROCESS_INSTANCE_ID_ NVARCHAR2(64),
      PROC_DEF_ID_ NVARCHAR2(64),
      ELEMENT_ID_ NVARCHAR2(255),
      ELEMENT_NAME_ NVARCHAR2(255),
      SCOPE_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      CORRELATION_ID_ NVARCHAR2(255),
      RETRIES_ INTEGER,
      EXCEPTION_STACK_ID_ NVARCHAR2(64),
      EXCEPTION_MSG_ NVARCHAR2(2000),
      DUEDATE_ TIMESTAMP(6),
      REPEAT_ NVARCHAR2(255),
      HANDLER_TYPE_ NVARCHAR2(255),
      HANDLER_CFG_ NVARCHAR2(2000),
      CUSTOM_VALUES_ID_ NVARCHAR2(64),
      CREATE_TIME_ TIMESTAMP(6),
      TENANT_ID_ NVARCHAR2(255) DEFAULT '',
      primary key (ID_)
  );
  
  create table ACT_RU_TIMER_JOB (
      ID_ NVARCHAR2(64) NOT NULL,
      REV_ INTEGER,
      CATEGORY_ NVARCHAR2(255),
      TYPE_ NVARCHAR2(255) NOT NULL,
      LOCK_EXP_TIME_ TIMESTAMP(6),
      LOCK_OWNER_ NVARCHAR2(255),
      EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)),
      EXECUTION_ID_ NVARCHAR2(64),
      PROCESS_INSTANCE_ID_ NVARCHAR2(64),
      PROC_DEF_ID_ NVARCHAR2(64),
      ELEMENT_ID_ NVARCHAR2(255),
      ELEMENT_NAME_ NVARCHAR2(255),
      SCOPE_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      CORRELATION_ID_ NVARCHAR2(255),
      RETRIES_ INTEGER,
      EXCEPTION_STACK_ID_ NVARCHAR2(64),
      EXCEPTION_MSG_ NVARCHAR2(2000),
      DUEDATE_ TIMESTAMP(6),
      REPEAT_ NVARCHAR2(255),
      HANDLER_TYPE_ NVARCHAR2(255),
      HANDLER_CFG_ NVARCHAR2(2000),
      CUSTOM_VALUES_ID_ NVARCHAR2(64),
      CREATE_TIME_ TIMESTAMP(6),
      TENANT_ID_ NVARCHAR2(255) DEFAULT '',
      primary key (ID_)
  );
  
  create table ACT_RU_SUSPENDED_JOB (
      ID_ NVARCHAR2(64) NOT NULL,
      REV_ INTEGER,
      CATEGORY_ NVARCHAR2(255),
      TYPE_ NVARCHAR2(255) NOT NULL,
      EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)),
      EXECUTION_ID_ NVARCHAR2(64),
      PROCESS_INSTANCE_ID_ NVARCHAR2(64),
      PROC_DEF_ID_ NVARCHAR2(64),
      ELEMENT_ID_ NVARCHAR2(255),
      ELEMENT_NAME_ NVARCHAR2(255),
      SCOPE_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      CORRELATION_ID_ NVARCHAR2(255),
      RETRIES_ INTEGER,
      EXCEPTION_STACK_ID_ NVARCHAR2(64),
      EXCEPTION_MSG_ NVARCHAR2(2000),
      DUEDATE_ TIMESTAMP(6),
      REPEAT_ NVARCHAR2(255),
      HANDLER_TYPE_ NVARCHAR2(255),
      HANDLER_CFG_ NVARCHAR2(2000),
      CUSTOM_VALUES_ID_ NVARCHAR2(64),
      CREATE_TIME_ TIMESTAMP(6),
      TENANT_ID_ NVARCHAR2(255) DEFAULT '',
      primary key (ID_)
  );
  
  create table ACT_RU_DEADLETTER_JOB (
      ID_ NVARCHAR2(64) NOT NULL,
      REV_ INTEGER,
      CATEGORY_ NVARCHAR2(255),
      TYPE_ NVARCHAR2(255) NOT NULL,
      EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)),
      EXECUTION_ID_ NVARCHAR2(64),
      PROCESS_INSTANCE_ID_ NVARCHAR2(64),
      PROC_DEF_ID_ NVARCHAR2(64),
      ELEMENT_ID_ NVARCHAR2(255),
      ELEMENT_NAME_ NVARCHAR2(255),
      SCOPE_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      CORRELATION_ID_ NVARCHAR2(255),
      EXCEPTION_STACK_ID_ NVARCHAR2(64),
      EXCEPTION_MSG_ NVARCHAR2(2000),
      DUEDATE_ TIMESTAMP(6),
      REPEAT_ NVARCHAR2(255),
      HANDLER_TYPE_ NVARCHAR2(255),
      HANDLER_CFG_ NVARCHAR2(2000),
      CUSTOM_VALUES_ID_ NVARCHAR2(64),
      CREATE_TIME_ TIMESTAMP(6),
      TENANT_ID_ NVARCHAR2(255) DEFAULT '',
      primary key (ID_)
  );
  
  create table ACT_RU_HISTORY_JOB (
      ID_ NVARCHAR2(64) NOT NULL,
      REV_ INTEGER,
      LOCK_EXP_TIME_ TIMESTAMP(6),
      LOCK_OWNER_ NVARCHAR2(255),
      RETRIES_ INTEGER,
      EXCEPTION_STACK_ID_ NVARCHAR2(64),
      EXCEPTION_MSG_ NVARCHAR2(2000),
      HANDLER_TYPE_ NVARCHAR2(255),
      HANDLER_CFG_ NVARCHAR2(2000),
      CUSTOM_VALUES_ID_ NVARCHAR2(64),
      ADV_HANDLER_CFG_ID_ NVARCHAR2(64),
      CREATE_TIME_ TIMESTAMP(6),
      SCOPE_TYPE_ NVARCHAR2(255),
      TENANT_ID_ NVARCHAR2(255) DEFAULT '',
      primary key (ID_)
  );
  
  create table ACT_RU_EXTERNAL_JOB (
      ID_ NVARCHAR2(64) NOT NULL,
      REV_ INTEGER,
      CATEGORY_ NVARCHAR2(255),
      TYPE_ NVARCHAR2(255) NOT NULL,
      LOCK_EXP_TIME_ TIMESTAMP(6),
      LOCK_OWNER_ NVARCHAR2(255),
      EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)),
      EXECUTION_ID_ NVARCHAR2(64),
      PROCESS_INSTANCE_ID_ NVARCHAR2(64),
      PROC_DEF_ID_ NVARCHAR2(64),
      ELEMENT_ID_ NVARCHAR2(255),
      ELEMENT_NAME_ NVARCHAR2(255),
      SCOPE_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      CORRELATION_ID_ NVARCHAR2(255),
      RETRIES_ INTEGER,
      EXCEPTION_STACK_ID_ NVARCHAR2(64),
      EXCEPTION_MSG_ NVARCHAR2(2000),
      DUEDATE_ TIMESTAMP(6),
      REPEAT_ NVARCHAR2(255),
      HANDLER_TYPE_ NVARCHAR2(255),
      HANDLER_CFG_ NVARCHAR2(2000),
      CUSTOM_VALUES_ID_ NVARCHAR2(64),
      CREATE_TIME_ TIMESTAMP(6),
      TENANT_ID_ NVARCHAR2(255) DEFAULT '',
      primary key (ID_)
  );
  
  create index ACT_IDX_JOB_EXCEPTION on ACT_RU_JOB(EXCEPTION_STACK_ID_);
  create index ACT_IDX_JOB_CUSTOM_VAL_ID on ACT_RU_JOB(CUSTOM_VALUES_ID_);
  create index ACT_IDX_JOB_CORRELATION_ID on ACT_RU_JOB(CORRELATION_ID_);
  
  create index ACT_IDX_TJOB_EXCEPTION on ACT_RU_TIMER_JOB(EXCEPTION_STACK_ID_);
  create index ACT_IDX_TJOB_CUSTOM_VAL_ID on ACT_RU_TIMER_JOB(CUSTOM_VALUES_ID_);
  create index ACT_IDX_TJOB_CORRELATION_ID on ACT_RU_TIMER_JOB(CORRELATION_ID_);
  create index ACT_IDX_TJOB_DUEDATE on ACT_RU_TIMER_JOB(DUEDATE_);
  
  create index ACT_IDX_SJOB_EXCEPTION on ACT_RU_SUSPENDED_JOB(EXCEPTION_STACK_ID_);
  create index ACT_IDX_SJOB_CUSTOM_VAL_ID on ACT_RU_SUSPENDED_JOB(CUSTOM_VALUES_ID_);
  create index ACT_IDX_SJOB_CORRELATION_ID on ACT_RU_SUSPENDED_JOB(CORRELATION_ID_);
  
  create index ACT_IDX_DJOB_EXCEPTION on ACT_RU_DEADLETTER_JOB(EXCEPTION_STACK_ID_);
  create index ACT_IDX_DJOB_CUSTOM_VAL_ID on ACT_RU_DEADLETTER_JOB(CUSTOM_VALUES_ID_);
  create index ACT_IDX_DJOB_CORRELATION_ID on ACT_RU_DEADLETTER_JOB(CORRELATION_ID_);
  
  create index ACT_IDX_EJOB_EXCEPTION on ACT_RU_EXTERNAL_JOB(EXCEPTION_STACK_ID_);
  create index ACT_IDX_EJOB_CUSTOM_VAL_ID on ACT_RU_EXTERNAL_JOB(CUSTOM_VALUES_ID_);
  create index ACT_IDX_EJOB_CORRELATION_ID on ACT_RU_EXTERNAL_JOB(CORRELATION_ID_);
  
  alter table ACT_RU_JOB
      add constraint ACT_FK_JOB_EXCEPTION
      foreign key (EXCEPTION_STACK_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_JOB
      add constraint ACT_FK_JOB_CUSTOM_VAL
      foreign key (CUSTOM_VALUES_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_TIMER_JOB
      add constraint ACT_FK_TJOB_EXCEPTION
      foreign key (EXCEPTION_STACK_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_TIMER_JOB
      add constraint ACT_FK_TJOB_CUSTOM_VAL
      foreign key (CUSTOM_VALUES_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_SUSPENDED_JOB
      add constraint ACT_FK_SJOB_EXCEPTION
      foreign key (EXCEPTION_STACK_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_SUSPENDED_JOB
      add constraint ACT_FK_SJOB_CUSTOM_VAL
      foreign key (CUSTOM_VALUES_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_DEADLETTER_JOB
      add constraint ACT_FK_DJOB_EXCEPTION
      foreign key (EXCEPTION_STACK_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_DEADLETTER_JOB
      add constraint ACT_FK_DJOB_CUSTOM_VAL
      foreign key (CUSTOM_VALUES_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_EXTERNAL_JOB
      add constraint ACT_FK_EJOB_EXCEPTION
      foreign key (EXCEPTION_STACK_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_EXTERNAL_JOB
      add constraint ACT_FK_EJOB_CUSTOM_VAL
      foreign key (CUSTOM_VALUES_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  create index ACT_IDX_JOB_SCOPE on ACT_RU_JOB(SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_JOB_SUB_SCOPE on ACT_RU_JOB(SUB_SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_JOB_SCOPE_DEF on ACT_RU_JOB(SCOPE_DEFINITION_ID_, SCOPE_TYPE_);
  
  create index ACT_IDX_TJOB_SCOPE on ACT_RU_TIMER_JOB(SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_TJOB_SUB_SCOPE on ACT_RU_TIMER_JOB(SUB_SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_TJOB_SCOPE_DEF on ACT_RU_TIMER_JOB(SCOPE_DEFINITION_ID_, SCOPE_TYPE_); 
  
  create index ACT_IDX_SJOB_SCOPE on ACT_RU_SUSPENDED_JOB(SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_SJOB_SUB_SCOPE on ACT_RU_SUSPENDED_JOB(SUB_SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_SJOB_SCOPE_DEF on ACT_RU_SUSPENDED_JOB(SCOPE_DEFINITION_ID_, SCOPE_TYPE_);   
  
  create index ACT_IDX_DJOB_SCOPE on ACT_RU_DEADLETTER_JOB(SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_DJOB_SUB_SCOPE on ACT_RU_DEADLETTER_JOB(SUB_SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_DJOB_SCOPE_DEF on ACT_RU_DEADLETTER_JOB(SCOPE_DEFINITION_ID_, SCOPE_TYPE_);     
  
  create index ACT_IDX_EJOB_SCOPE on ACT_RU_EXTERNAL_JOB(SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_EJOB_SUB_SCOPE on ACT_RU_EXTERNAL_JOB(SUB_SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_EJOB_SCOPE_DEF on ACT_RU_EXTERNAL_JOB(SCOPE_DEFINITION_ID_, SCOPE_TYPE_);
  
  insert into ACT_GE_PROPERTY values ('job.schema.version', '6.7.1.0', 1);
  
  create table FLW_RU_BATCH (
      ID_ NVARCHAR2(64) not null,
      REV_ INTEGER,
      TYPE_ NVARCHAR2(64) not null,
      SEARCH_KEY_ NVARCHAR2(255),
      SEARCH_KEY2_ NVARCHAR2(255),
      CREATE_TIME_ TIMESTAMP(6) not null,
      COMPLETE_TIME_ TIMESTAMP(6),
      STATUS_ NVARCHAR2(255),
      BATCH_DOC_ID_ NVARCHAR2(64),
      TENANT_ID_ NVARCHAR2(255) default '',
      primary key (ID_)
  );
  
  create table FLW_RU_BATCH_PART (
      ID_ NVARCHAR2(64) not null,
      REV_ INTEGER,
      BATCH_ID_ NVARCHAR2(64),
      TYPE_ NVARCHAR2(64) not null,
      SCOPE_ID_ NVARCHAR2(64),
      SUB_SCOPE_ID_ NVARCHAR2(64),
      SCOPE_TYPE_ NVARCHAR2(64),
      SEARCH_KEY_ NVARCHAR2(255),
      SEARCH_KEY2_ NVARCHAR2(255),
      CREATE_TIME_ TIMESTAMP(6) not null,
      COMPLETE_TIME_ TIMESTAMP(6),
      STATUS_ NVARCHAR2(255),
      RESULT_DOC_ID_ NVARCHAR2(64),
      TENANT_ID_ NVARCHAR2(255) default '',
      primary key (ID_)
  );
  
  create index FLW_IDX_BATCH_PART on FLW_RU_BATCH_PART(BATCH_ID_);
  
  alter table FLW_RU_BATCH_PART
      add constraint FLW_FK_BATCH_PART_PARENT
      foreign key (BATCH_ID_)
      references FLW_RU_BATCH (ID_);
  
  insert into ACT_GE_PROPERTY values ('batch.schema.version', '6.7.1.0', 1);
  
  
  create table ACT_RU_TASK (
      ID_ NVARCHAR2(64),
      REV_ INTEGER,
      EXECUTION_ID_ NVARCHAR2(64),
      PROC_INST_ID_ NVARCHAR2(64),
      PROC_DEF_ID_ NVARCHAR2(64),
      TASK_DEF_ID_ NVARCHAR2(64),
      SCOPE_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      PROPAGATED_STAGE_INST_ID_ NVARCHAR2(255),
      NAME_ NVARCHAR2(255),
      PARENT_TASK_ID_ NVARCHAR2(64),
      DESCRIPTION_ NVARCHAR2(2000),
      TASK_DEF_KEY_ NVARCHAR2(255),
      OWNER_ NVARCHAR2(255),
      ASSIGNEE_ NVARCHAR2(255),
      DELEGATION_ NVARCHAR2(64),
      PRIORITY_ INTEGER,
      CREATE_TIME_ TIMESTAMP(6),
      DUE_DATE_ TIMESTAMP(6),
      CATEGORY_ NVARCHAR2(255),
      SUSPENSION_STATE_ INTEGER,
      TENANT_ID_ NVARCHAR2(255) DEFAULT '',
      FORM_KEY_ NVARCHAR2(255),
      CLAIM_TIME_ TIMESTAMP(6),
      IS_COUNT_ENABLED_ NUMBER(1,0) CHECK (IS_COUNT_ENABLED_ IN (1,0)),
      VAR_COUNT_ INTEGER, 
      ID_LINK_COUNT_ INTEGER,
      SUB_TASK_COUNT_ INTEGER,
      primary key (ID_)
  );
  
  create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_);
  create index ACT_IDX_TASK_SCOPE on ACT_RU_TASK(SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_TASK_SUB_SCOPE on ACT_RU_TASK(SUB_SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_TASK_SCOPE_DEF on ACT_RU_TASK(SCOPE_DEFINITION_ID_, SCOPE_TYPE_);
  
  insert into ACT_GE_PROPERTY values ('task.schema.version', '6.7.1.0', 1);
  
  create table ACT_HI_TASKINST (
      ID_ NVARCHAR2(64) not null,
      REV_ INTEGER default 1,
      PROC_DEF_ID_ NVARCHAR2(64),
      TASK_DEF_ID_ NVARCHAR2(64),
      TASK_DEF_KEY_ NVARCHAR2(255),
      PROC_INST_ID_ NVARCHAR2(64),
      EXECUTION_ID_ NVARCHAR2(64),
      SCOPE_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      PROPAGATED_STAGE_INST_ID_ NVARCHAR2(255),
      PARENT_TASK_ID_ NVARCHAR2(64),
      NAME_ NVARCHAR2(255),
      DESCRIPTION_ NVARCHAR2(2000),
      OWNER_ NVARCHAR2(255),
      ASSIGNEE_ NVARCHAR2(255),
      START_TIME_ TIMESTAMP(6) not null,
      CLAIM_TIME_ TIMESTAMP(6),
      END_TIME_ TIMESTAMP(6),
      DURATION_ NUMBER(19,0),
      DELETE_REASON_ NVARCHAR2(2000),
      PRIORITY_ INTEGER,
      DUE_DATE_ TIMESTAMP(6),
      FORM_KEY_ NVARCHAR2(255),
      CATEGORY_ NVARCHAR2(255),
      TENANT_ID_ NVARCHAR2(255) default '',
      LAST_UPDATED_TIME_ TIMESTAMP(6),
      primary key (ID_)
  );
  
  create table ACT_HI_TSK_LOG (
      ID_ NUMBER(19),
      TYPE_ NVARCHAR2(64),
      TASK_ID_ NVARCHAR2(64) not null,
      TIME_STAMP_ TIMESTAMP(6) not null,
      USER_ID_ NVARCHAR2(255),
      DATA_ NVARCHAR2(2000),
      EXECUTION_ID_ NVARCHAR2(64),
      PROC_INST_ID_ NVARCHAR2(64),
      PROC_DEF_ID_ NVARCHAR2(64),
      SCOPE_ID_ NVARCHAR2(255),
      SCOPE_DEFINITION_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      TENANT_ID_ NVARCHAR2(255) default '',
      primary key (ID_)
  );
  
  create sequence act_hi_task_evt_log_seq start with 1 increment by 1;
  
  create index ACT_IDX_HI_TASK_SCOPE on ACT_HI_TASKINST(SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_HI_TASK_SUB_SCOPE on ACT_HI_TASKINST(SUB_SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_HI_TASK_SCOPE_DEF on ACT_HI_TASKINST(SCOPE_DEFINITION_ID_, SCOPE_TYPE_);
  
  create table ACT_RU_VARIABLE (
      ID_ NVARCHAR2(64) not null,
      REV_ INTEGER,
      TYPE_ NVARCHAR2(255) not null,
      NAME_ NVARCHAR2(255) not null,
      EXECUTION_ID_ NVARCHAR2(64),
      PROC_INST_ID_ NVARCHAR2(64),
      TASK_ID_ NVARCHAR2(64),
      SCOPE_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      BYTEARRAY_ID_ NVARCHAR2(64),
      DOUBLE_ NUMBER(*,10),
      LONG_ NUMBER(19,0),
      TEXT_ NVARCHAR2(2000),
      TEXT2_ NVARCHAR2(2000),
      primary key (ID_)
  );
  
  create index ACT_IDX_RU_VAR_SCOPE_ID_TYPE on ACT_RU_VARIABLE(SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_RU_VAR_SUB_ID_TYPE on ACT_RU_VARIABLE(SUB_SCOPE_ID_, SCOPE_TYPE_);
  
  create index ACT_IDX_VAR_BYTEARRAY on ACT_RU_VARIABLE(BYTEARRAY_ID_);
  alter table ACT_RU_VARIABLE 
      add constraint ACT_FK_VAR_BYTEARRAY 
      foreign key (BYTEARRAY_ID_) 
      references ACT_GE_BYTEARRAY (ID_);
  
  insert into ACT_GE_PROPERTY values ('variable.schema.version', '6.7.1.0', 1);
  
  create table ACT_HI_VARINST (
      ID_ NVARCHAR2(64) not null,
      REV_ INTEGER default 1,
      PROC_INST_ID_ NVARCHAR2(64),
      EXECUTION_ID_ NVARCHAR2(64),
      TASK_ID_ NVARCHAR2(64),
      NAME_ NVARCHAR2(255) not null,
      VAR_TYPE_ NVARCHAR2(100),
      SCOPE_ID_ NVARCHAR2(255),
      SUB_SCOPE_ID_ NVARCHAR2(255),
      SCOPE_TYPE_ NVARCHAR2(255),
      BYTEARRAY_ID_ NVARCHAR2(64),
      DOUBLE_ NUMBER(*,10),
      LONG_ NUMBER(19,0),
      TEXT_ NVARCHAR2(2000),
      TEXT2_ NVARCHAR2(2000),
      CREATE_TIME_ TIMESTAMP(6),
      LAST_UPDATED_TIME_ TIMESTAMP(6),
      primary key (ID_)
  );
  
  create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_);
  create index ACT_IDX_HI_VAR_SCOPE_ID_TYPE on ACT_HI_VARINST(SCOPE_ID_, SCOPE_TYPE_);
  create index ACT_IDX_HI_VAR_SUB_ID_TYPE on ACT_HI_VARINST(SUB_SCOPE_ID_, SCOPE_TYPE_);
  
  
  create table ACT_RU_EVENT_SUBSCR (
      ID_ NVARCHAR2(64) not null,
      REV_ integer,
      EVENT_TYPE_ NVARCHAR2(255) not null,
      EVENT_NAME_ NVARCHAR2(255),
      EXECUTION_ID_ NVARCHAR2(64),
      PROC_INST_ID_ NVARCHAR2(64),
      ACTIVITY_ID_ NVARCHAR2(64),
      CONFIGURATION_ NVARCHAR2(255),
      CREATED_ TIMESTAMP(6) not null,
      PROC_DEF_ID_ NVARCHAR2(64),
      SUB_SCOPE_ID_ NVARCHAR2(64),
      SCOPE_ID_ NVARCHAR2(64),
      SCOPE_DEFINITION_ID_ NVARCHAR2(64),
      SCOPE_TYPE_ NVARCHAR2(64),
      TENANT_ID_ NVARCHAR2(255) DEFAULT '',
      primary key (ID_)
  );
  
  create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_);
  create index ACT_IDX_EVENT_SUBSCR on ACT_RU_EVENT_SUBSCR(EXECUTION_ID_);
  
  insert into ACT_GE_PROPERTY values ('eventsubscription.schema.version', '6.7.1.0', 1);
  