text: -- create case definition table --
  create table ACT_RE_CASE_DEF (
      ID_ varchar(64) not null,
      REV_ integer,
      CATEGORY_ varchar(255),
      NAME_ varchar(255),
      KEY_ varchar(255) not null,
      VERSION_ integer not null,
      DEPLOYMENT_ID_ varchar(64),
      RESOURCE_NAME_ varchar(4000),
      DGRM_RESOURCE_NAME_ varchar(4000),
      primary key (ID_)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  
  -- create case execution table --
  create table ACT_RU_CASE_EXECUTION (
      ID_ varchar(64) NOT NULL,
      REV_ integer,
      CASE_INST_ID_ varchar(64),
      SUPER_CASE_EXEC_ varchar(64),
      SUPER_EXEC_ varchar(64),
      BUSINESS_KEY_ varchar(255),
      PARENT_ID_ varchar(64),
      CASE_DEF_ID_ varchar(64),
      ACT_ID_ varchar(255),
      PREV_STATE_ integer,
      CURRENT_STATE_ integer,
      REQUIRED_ boolean,
      primary key (ID_)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  
  -- create case sentry part table --
  
  create table ACT_RU_CASE_SENTRY_PART (
      ID_ varchar(64) NOT NULL,
      REV_ integer,
      CASE_INST_ID_ varchar(64),
      CASE_EXEC_ID_ varchar(64),
      SENTRY_ID_ varchar(255),
      TYPE_ varchar(255),
      SOURCE_CASE_EXEC_ID_ varchar(64),
      STANDARD_EVENT_ varchar(255),
      SOURCE_ varchar(255),
      SATISFIED_ boolean,
      primary key (ID_)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
  
  -- create unique constraint on ACT_RE_CASE_DEF --
  alter table ACT_RE_CASE_DEF
      add constraint ACT_UNIQ_CASE_DEF
      unique (KEY_,VERSION_);
  
  -- create index on business key --
  create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_);
  
  -- create foreign key constraints on ACT_RU_CASE_EXECUTION --
  alter table ACT_RU_CASE_EXECUTION
      add constraint ACT_FK_CASE_EXE_CASE_INST
      foreign key (CASE_INST_ID_)
      references ACT_RU_CASE_EXECUTION(ID_) on delete cascade on update cascade;
  
  alter table ACT_RU_CASE_EXECUTION
      add constraint ACT_FK_CASE_EXE_PARENT
      foreign key (PARENT_ID_)
      references ACT_RU_CASE_EXECUTION(ID_);
  
  alter table ACT_RU_CASE_EXECUTION
      add constraint ACT_FK_CASE_EXE_CASE_DEF
      foreign key (CASE_DEF_ID_)
      references ACT_RE_CASE_DEF(ID_);
  
  -- create foreign key constraints on ACT_RU_VARIABLE --
  alter table ACT_RU_VARIABLE
      add constraint ACT_FK_VAR_CASE_EXE
      foreign key (CASE_EXECUTION_ID_)
      references ACT_RU_CASE_EXECUTION(ID_);
  
  alter table ACT_RU_VARIABLE
      add constraint ACT_FK_VAR_CASE_INST
      foreign key (CASE_INST_ID_)
      references ACT_RU_CASE_EXECUTION(ID_);
  
  -- create foreign key constraints on ACT_RU_TASK --
  alter table ACT_RU_TASK
      add constraint ACT_FK_TASK_CASE_EXE
      foreign key (CASE_EXECUTION_ID_)
      references ACT_RU_CASE_EXECUTION(ID_);
  
  alter table ACT_RU_TASK
    add constraint ACT_FK_TASK_CASE_DEF
    foreign key (CASE_DEF_ID_)
    references ACT_RE_CASE_DEF(ID_);
  
  -- create foreign key constraints on ACT_RU_CASE_SENTRY_PART --
  alter table ACT_RU_CASE_SENTRY_PART
      add constraint ACT_FK_CASE_SENTRY_CASE_INST
      foreign key (CASE_INST_ID_)
      references ACT_RU_CASE_EXECUTION(ID_);
  
  alter table ACT_RU_CASE_SENTRY_PART
      add constraint ACT_FK_CASE_SENTRY_CASE_EXEC
      foreign key (CASE_EXEC_ID_)
      references ACT_RU_CASE_EXECUTION(ID_);
  