text: create table ACT_GE_PROPERTY (
      NAME_ varchar(64),
      VALUE_ varchar(300),
      REV_ integer,
      primary key (NAME_)
  );
  
  create table ACT_GE_BYTEARRAY (
      ID_ varchar(64),
      REV_ integer,
      NAME_ varchar(255),
      DEPLOYMENT_ID_ varchar(64),
      BYTES_ bytea,
      GENERATED_ boolean,
      primary key (ID_)
  );
  
  insert into ACT_GE_PROPERTY
  values ('common.schema.version', '6.7.0.1', 1);
  
  insert into ACT_GE_PROPERTY
  values ('next.dbid', '1', 1);
  
  
  create table ACT_RU_ENTITYLINK (
      ID_ varchar(64),
      REV_ integer,
      CREATE_TIME_ timestamp,
      LINK_TYPE_ varchar(255),
      SCOPE_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      SCOPE_DEFINITION_ID_ varchar(255),
      PARENT_ELEMENT_ID_ varchar(255),
      REF_SCOPE_ID_ varchar(255),
      REF_SCOPE_TYPE_ varchar(255),
      REF_SCOPE_DEFINITION_ID_ varchar(255),
      ROOT_SCOPE_ID_ varchar(255),
      ROOT_SCOPE_TYPE_ varchar(255),
      HIERARCHY_TYPE_ varchar(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.0.1', 1);
  
  create table ACT_HI_ENTITYLINK (
      ID_ varchar(64),
      LINK_TYPE_ varchar(255),
      CREATE_TIME_ timestamp,
      SCOPE_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      SCOPE_DEFINITION_ID_ varchar(255),
      PARENT_ELEMENT_ID_ varchar(255),
      REF_SCOPE_ID_ varchar(255),
      REF_SCOPE_TYPE_ varchar(255),
      REF_SCOPE_DEFINITION_ID_ varchar(255),
      ROOT_SCOPE_ID_ varchar(255),
      ROOT_SCOPE_TYPE_ varchar(255),
      HIERARCHY_TYPE_ varchar(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_ varchar(64),
      REV_ integer,
      GROUP_ID_ varchar(255),
      TYPE_ varchar(255),
      USER_ID_ varchar(255),
      TASK_ID_ varchar(64),
      PROC_INST_ID_ varchar(64),
      PROC_DEF_ID_ varchar (64),
      SCOPE_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      SCOPE_DEFINITION_ID_ varchar(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.0.1', 1);
  
  create table ACT_HI_IDENTITYLINK (
      ID_ varchar(64),
      GROUP_ID_ varchar(255),
      TYPE_ varchar(255),
      USER_ID_ varchar(255),
      TASK_ID_ varchar(64),
      CREATE_TIME_ timestamp,
      PROC_INST_ID_ varchar(64),
      SCOPE_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      SCOPE_DEFINITION_ID_ varchar(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_ varchar(64) NOT NULL,
      REV_ integer,
      CATEGORY_ varchar(255),
      TYPE_ varchar(255) NOT NULL,
      LOCK_EXP_TIME_ timestamp,
      LOCK_OWNER_ varchar(255),
      EXCLUSIVE_ boolean,
      EXECUTION_ID_ varchar(64),
      PROCESS_INSTANCE_ID_ varchar(64),
      PROC_DEF_ID_ varchar(64),
      ELEMENT_ID_ varchar(255),
      ELEMENT_NAME_ varchar(255),
      SCOPE_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      SCOPE_DEFINITION_ID_ varchar(255),
      CORRELATION_ID_ varchar(255),
      RETRIES_ integer,
      EXCEPTION_STACK_ID_ varchar(64),
      EXCEPTION_MSG_ varchar(4000),
      DUEDATE_ timestamp,
      REPEAT_ varchar(255),
      HANDLER_TYPE_ varchar(255),
      HANDLER_CFG_ varchar(4000),
      CUSTOM_VALUES_ID_ varchar(64),
      CREATE_TIME_ timestamp,
      TENANT_ID_ varchar(255) default '',
      primary key (ID_)
  );
  
  create table ACT_RU_TIMER_JOB (
      ID_ varchar(64) NOT NULL,
      REV_ integer,
      CATEGORY_ varchar(255),
      TYPE_ varchar(255) NOT NULL,
      LOCK_EXP_TIME_ timestamp,
      LOCK_OWNER_ varchar(255),
      EXCLUSIVE_ boolean,
      EXECUTION_ID_ varchar(64),
      PROCESS_INSTANCE_ID_ varchar(64),
      PROC_DEF_ID_ varchar(64),
      ELEMENT_ID_ varchar(255),
      ELEMENT_NAME_ varchar(255),
      SCOPE_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      SCOPE_DEFINITION_ID_ varchar(255),
      CORRELATION_ID_ varchar(255),
      RETRIES_ integer,
      EXCEPTION_STACK_ID_ varchar(64),
      EXCEPTION_MSG_ varchar(4000),
      DUEDATE_ timestamp,
      REPEAT_ varchar(255),
      HANDLER_TYPE_ varchar(255),
      HANDLER_CFG_ varchar(4000),
      CUSTOM_VALUES_ID_ varchar(64),
      CREATE_TIME_ timestamp,
      TENANT_ID_ varchar(255) default '',
      primary key (ID_)
  );
  
  create table ACT_RU_SUSPENDED_JOB (
      ID_ varchar(64) NOT NULL,
      REV_ integer,
      CATEGORY_ varchar(255),
      TYPE_ varchar(255) NOT NULL,
      EXCLUSIVE_ boolean,
      EXECUTION_ID_ varchar(64),
      PROCESS_INSTANCE_ID_ varchar(64),
      PROC_DEF_ID_ varchar(64),
      ELEMENT_ID_ varchar(255),
      ELEMENT_NAME_ varchar(255),
      SCOPE_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      SCOPE_DEFINITION_ID_ varchar(255),
      CORRELATION_ID_ varchar(255),
      RETRIES_ integer,
      EXCEPTION_STACK_ID_ varchar(64),
      EXCEPTION_MSG_ varchar(4000),
      DUEDATE_ timestamp,
      REPEAT_ varchar(255),
      HANDLER_TYPE_ varchar(255),
      HANDLER_CFG_ varchar(4000),
      CUSTOM_VALUES_ID_ varchar(64),
      CREATE_TIME_ timestamp,
      TENANT_ID_ varchar(255) default '',
      primary key (ID_)
  );
  
  create table ACT_RU_DEADLETTER_JOB (
      ID_ varchar(64) NOT NULL,
      REV_ integer,
      CATEGORY_ varchar(255),
      TYPE_ varchar(255) NOT NULL,
      EXCLUSIVE_ boolean,
      EXECUTION_ID_ varchar(64),
      PROCESS_INSTANCE_ID_ varchar(64),
      PROC_DEF_ID_ varchar(64),
      ELEMENT_ID_ varchar(255),
      ELEMENT_NAME_ varchar(255),
      SCOPE_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      SCOPE_DEFINITION_ID_ varchar(255),
      CORRELATION_ID_ varchar(255),
      EXCEPTION_STACK_ID_ varchar(64),
      EXCEPTION_MSG_ varchar(4000),
      DUEDATE_ timestamp,
      REPEAT_ varchar(255),
      HANDLER_TYPE_ varchar(255),
      HANDLER_CFG_ varchar(4000),
      CUSTOM_VALUES_ID_ varchar(64),
      CREATE_TIME_ timestamp,
      TENANT_ID_ varchar(255) default '',
      primary key (ID_)
  );
  
  create table ACT_RU_HISTORY_JOB (
      ID_ varchar(64) NOT NULL,
      REV_ integer,
      LOCK_EXP_TIME_ timestamp,
      LOCK_OWNER_ varchar(255),
      RETRIES_ integer,
      EXCEPTION_STACK_ID_ varchar(64),
      EXCEPTION_MSG_ varchar(4000),
      HANDLER_TYPE_ varchar(255),
      HANDLER_CFG_ varchar(4000),
      CUSTOM_VALUES_ID_ varchar(64),
      ADV_HANDLER_CFG_ID_ varchar(64),
      CREATE_TIME_ timestamp,
      SCOPE_TYPE_ varchar(255),
      TENANT_ID_ varchar(255) default '',
      primary key (ID_)
  );
  
  create table ACT_RU_EXTERNAL_JOB (
      ID_ varchar(64) NOT NULL,
      REV_ integer,
      CATEGORY_ varchar(255),
      TYPE_ varchar(255) NOT NULL,
      LOCK_EXP_TIME_ timestamp,
      LOCK_OWNER_ varchar(255),
      EXCLUSIVE_ boolean,
      EXECUTION_ID_ varchar(64),
      PROCESS_INSTANCE_ID_ varchar(64),
      PROC_DEF_ID_ varchar(64),
      ELEMENT_ID_ varchar(255),
      ELEMENT_NAME_ varchar(255),
      SCOPE_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      SCOPE_DEFINITION_ID_ varchar(255),
      CORRELATION_ID_ varchar(255),
      RETRIES_ integer,
      EXCEPTION_STACK_ID_ varchar(64),
      EXCEPTION_MSG_ varchar(4000),
      DUEDATE_ timestamp,
      REPEAT_ varchar(255),
      HANDLER_TYPE_ varchar(255),
      HANDLER_CFG_ varchar(4000),
      CUSTOM_VALUES_ID_ varchar(64),
      CREATE_TIME_ timestamp,
      TENANT_ID_ varchar(255) default '',
      primary key (ID_)
  );
  
  create index ACT_IDX_JOB_EXCEPTION_STACK_ID on ACT_RU_JOB(EXCEPTION_STACK_ID_);
  create index ACT_IDX_JOB_CUSTOM_VALUES_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_TIMER_JOB_EXCEPTION_STACK_ID on ACT_RU_TIMER_JOB(EXCEPTION_STACK_ID_);
  create index ACT_IDX_TIMER_JOB_CUSTOM_VALUES_ID on ACT_RU_TIMER_JOB(CUSTOM_VALUES_ID_);
  create index ACT_IDX_TIMER_JOB_CORRELATION_ID on ACT_RU_TIMER_JOB(CORRELATION_ID_);
  create index ACT_IDX_TIMER_JOB_DUEDATE on ACT_RU_TIMER_JOB(DUEDATE_);
  
  create index ACT_IDX_SUSPENDED_JOB_EXCEPTION_STACK_ID on ACT_RU_SUSPENDED_JOB(EXCEPTION_STACK_ID_);
  create index ACT_IDX_SUSPENDED_JOB_CUSTOM_VALUES_ID on ACT_RU_SUSPENDED_JOB(CUSTOM_VALUES_ID_);
  create index ACT_IDX_SUSPENDED_JOB_CORRELATION_ID on ACT_RU_SUSPENDED_JOB(CORRELATION_ID_);
  
  create index ACT_IDX_DEADLETTER_JOB_EXCEPTION_STACK_ID on ACT_RU_DEADLETTER_JOB(EXCEPTION_STACK_ID_);
  create index ACT_IDX_DEADLETTER_JOB_CUSTOM_VALUES_ID on ACT_RU_DEADLETTER_JOB(CUSTOM_VALUES_ID_);
  create index ACT_IDX_DEADLETTER_JOB_CORRELATION_ID on ACT_RU_DEADLETTER_JOB(CORRELATION_ID_);
  
  create index ACT_IDX_EXTERNAL_JOB_EXCEPTION_STACK_ID on ACT_RU_EXTERNAL_JOB(EXCEPTION_STACK_ID_);
  create index ACT_IDX_EXTERNAL_JOB_CUSTOM_VALUES_ID on ACT_RU_EXTERNAL_JOB(CUSTOM_VALUES_ID_);
  create index ACT_IDX_EXTERNAL_JOB_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_VALUES
      foreign key (CUSTOM_VALUES_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_TIMER_JOB
      add constraint ACT_FK_TIMER_JOB_EXCEPTION
      foreign key (EXCEPTION_STACK_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_TIMER_JOB
      add constraint ACT_FK_TIMER_JOB_CUSTOM_VALUES
      foreign key (CUSTOM_VALUES_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_SUSPENDED_JOB
      add constraint ACT_FK_SUSPENDED_JOB_EXCEPTION
      foreign key (EXCEPTION_STACK_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_SUSPENDED_JOB
      add constraint ACT_FK_SUSPENDED_JOB_CUSTOM_VALUES
      foreign key (CUSTOM_VALUES_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_DEADLETTER_JOB
      add constraint ACT_FK_DEADLETTER_JOB_EXCEPTION
      foreign key (EXCEPTION_STACK_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_DEADLETTER_JOB
      add constraint ACT_FK_DEADLETTER_JOB_CUSTOM_VALUES
      foreign key (CUSTOM_VALUES_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_EXTERNAL_JOB
      add constraint ACT_FK_EXTERNAL_JOB_EXCEPTION
      foreign key (EXCEPTION_STACK_ID_)
      references ACT_GE_BYTEARRAY (ID_);
  
  alter table ACT_RU_EXTERNAL_JOB
      add constraint ACT_FK_EXTERNAL_JOB_CUSTOM_VALUES
      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.0.1', 1);
  
  create table FLW_RU_BATCH (
      ID_ varchar(64) not null,
      REV_ integer,
      TYPE_ varchar(64) not null,
      SEARCH_KEY_ varchar(255),
      SEARCH_KEY2_ varchar(255),
      CREATE_TIME_ timestamp not null,
      COMPLETE_TIME_ timestamp,
      STATUS_ varchar(255),
      BATCH_DOC_ID_ varchar(64),
      TENANT_ID_ varchar(255) default '',
      primary key (ID_)
  );
  
  create table FLW_RU_BATCH_PART (
      ID_ varchar(64) not null,
      REV_ integer,
      BATCH_ID_ varchar(64),
      TYPE_ varchar(64) not null,
      SCOPE_ID_ varchar(64),
      SUB_SCOPE_ID_ varchar(64),
      SCOPE_TYPE_ varchar(64),
      SEARCH_KEY_ varchar(255),
      SEARCH_KEY2_ varchar(255),
      CREATE_TIME_ timestamp not null,
      COMPLETE_TIME_ timestamp,
      STATUS_ varchar(255),
      RESULT_DOC_ID_ varchar(64),
      TENANT_ID_ varchar(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.0.1', 1);
  
  
  create table ACT_RU_TASK (
      ID_ varchar(64),
      REV_ integer,
      EXECUTION_ID_ varchar(64),
      PROC_INST_ID_ varchar(64),
      PROC_DEF_ID_ varchar(64),
      TASK_DEF_ID_ varchar(64),
      SCOPE_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      SCOPE_DEFINITION_ID_ varchar(255),
      PROPAGATED_STAGE_INST_ID_ varchar(255),
      NAME_ varchar(255),
      PARENT_TASK_ID_ varchar(64),
      DESCRIPTION_ varchar(4000),
      TASK_DEF_KEY_ varchar(255),
      OWNER_ varchar(255),
      ASSIGNEE_ varchar(255),
      DELEGATION_ varchar(64),
      PRIORITY_ integer,
      CREATE_TIME_ timestamp,
      DUE_DATE_ timestamp,
      CATEGORY_ varchar(255),
      SUSPENSION_STATE_ integer,
      TENANT_ID_ varchar(255) default '',
      FORM_KEY_ varchar(255),
      CLAIM_TIME_ timestamp,
      IS_COUNT_ENABLED_ boolean,
      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.0.1', 1);
  
  create table ACT_HI_TASKINST (
      ID_ varchar(64) not null,
      REV_ integer default 1,
      PROC_DEF_ID_ varchar(64),
      TASK_DEF_ID_ varchar(64),
      TASK_DEF_KEY_ varchar(255),
      PROC_INST_ID_ varchar(64),
      EXECUTION_ID_ varchar(64),
      SCOPE_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      SCOPE_DEFINITION_ID_ varchar(255),
      PROPAGATED_STAGE_INST_ID_ varchar(255),
      NAME_ varchar(255),
      PARENT_TASK_ID_ varchar(64),
      DESCRIPTION_ varchar(4000),
      OWNER_ varchar(255),
      ASSIGNEE_ varchar(255),
      START_TIME_ timestamp not null,
      CLAIM_TIME_ timestamp,
      END_TIME_ timestamp,
      DURATION_ bigint,
      DELETE_REASON_ varchar(4000),
      PRIORITY_ integer,
      DUE_DATE_ timestamp,
      FORM_KEY_ varchar(255),
      CATEGORY_ varchar(255),
      TENANT_ID_ varchar(255) default '',
      LAST_UPDATED_TIME_ timestamp,
      primary key (ID_)
  );
  
  create table ACT_HI_TSK_LOG (
      ID_ SERIAL PRIMARY KEY,
      TYPE_ varchar(64),
      TASK_ID_ varchar(64) not null,
      TIME_STAMP_ timestamp not null,
      USER_ID_ varchar(255),
      DATA_ varchar(4000),
      EXECUTION_ID_ varchar(64),
      PROC_INST_ID_ varchar(64),
      PROC_DEF_ID_ varchar(64),
      SCOPE_ID_ varchar(255),
      SCOPE_DEFINITION_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      TENANT_ID_ varchar(255) default ''
  );
  
  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_ varchar(64) not null,
      REV_ integer,
      TYPE_ varchar(255) not null,
      NAME_ varchar(255) not null,
      EXECUTION_ID_ varchar(64),
      PROC_INST_ID_ varchar(64),
      TASK_ID_ varchar(64),
      SCOPE_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      BYTEARRAY_ID_ varchar(64),
      DOUBLE_ double precision,
      LONG_ bigint,
      TEXT_ varchar(4000),
      TEXT2_ varchar(4000),
      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.0.1', 1);
  
  
  create table ACT_HI_VARINST (
      ID_ varchar(64) not null,
      REV_ integer default 1,
      PROC_INST_ID_ varchar(64),
      EXECUTION_ID_ varchar(64),
      TASK_ID_ varchar(64),
      NAME_ varchar(255) not null,
      VAR_TYPE_ varchar(100),
      SCOPE_ID_ varchar(255),
      SUB_SCOPE_ID_ varchar(255),
      SCOPE_TYPE_ varchar(255),
      BYTEARRAY_ID_ varchar(64),
      DOUBLE_ double precision,
      LONG_ bigint,
      TEXT_ varchar(4000),
      TEXT2_ varchar(4000),
      CREATE_TIME_ timestamp,
      LAST_UPDATED_TIME_ timestamp,
      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_ varchar(64) not null,
      REV_ integer,
      EVENT_TYPE_ varchar(255) not null,
      EVENT_NAME_ varchar(255),
      EXECUTION_ID_ varchar(64),
      PROC_INST_ID_ varchar(64),
      ACTIVITY_ID_ varchar(64),
      CONFIGURATION_ varchar(255),
      CREATED_ timestamp not null,
      PROC_DEF_ID_ varchar(64),
      SUB_SCOPE_ID_ varchar(64),
      SCOPE_ID_ varchar(64),
      SCOPE_DEFINITION_ID_ varchar(64),
      SCOPE_TYPE_ varchar(64),
      TENANT_ID_ varchar(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.0.1', 1);
  