-- =============================================
-- yanzhu-module-bpm 模块 MySQL 建表脚本
-- 包含：
-- 1. bpm 模块自身表结构
-- 2. Flowable 工作流表结构
-- =============================================

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- =============================================
-- 1. bpm 模块自身表结构
-- =============================================

-- 用户组表
CREATE TABLE IF NOT EXISTS `bpm_user_group` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
  `name` varchar(63) NOT NULL COMMENT '名称',
  `description` varchar(255) NOT NULL COMMENT '描述',
  `status` tinyint NOT NULL COMMENT '状态',
  `user_ids` varchar(255) NOT NULL COMMENT '用户编号列表',
  `creator` varchar(64) DEFAULT '' COMMENT '创建者',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updater` varchar(64) DEFAULT '' COMMENT '更新者',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
  PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户组';

-- 分类表
CREATE TABLE IF NOT EXISTS `bpm_category` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
  `name` varchar(63) NOT NULL COMMENT '名称',
  `code` varchar(63) NOT NULL COMMENT '编码',
  `description` varchar(255) NOT NULL COMMENT '描述',
  `status` tinyint NOT NULL COMMENT '状态',
  `sort` int NOT NULL COMMENT '排序',
  `creator` varchar(64) DEFAULT '' COMMENT '创建者',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updater` varchar(64) DEFAULT '' COMMENT '更新者',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
  PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '分类';

-- 动态表单表
CREATE TABLE IF NOT EXISTS `bpm_form` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
  `name` varchar(63) NOT NULL COMMENT '名称',
  `status` tinyint NOT NULL COMMENT '状态',
  `fields` varchar(255) NOT NULL COMMENT '字段列表',
  `conf` varchar(255) NOT NULL COMMENT '配置信息',
  `remark` varchar(255) DEFAULT NULL COMMENT '备注',
  `creator` varchar(64) DEFAULT '' COMMENT '创建者',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updater` varchar(64) DEFAULT '' COMMENT '更新者',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
  PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '动态表单';

-- =============================================
-- 2. Flowable 工作流表结构
-- =============================================

-- 部署表
CREATE TABLE IF NOT EXISTS `act_re_deployment` (
  `ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `NAME_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `CATEGORY_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TENANT_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `DEPLOY_TIME_` timestamp NULL DEFAULT NULL,
  `ENGINE_VERSION_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`ID_`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- 流程定义表
CREATE TABLE IF NOT EXISTS `act_re_procdef` (
  `ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `REV_` int(11) DEFAULT NULL,
  `CATEGORY_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `NAME_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `KEY_` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `VERSION_` int(11) NOT NULL,
  `DEPLOYMENT_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `RESOURCE_NAME_` varchar(4000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `DGRM_RESOURCE_NAME_` varchar(4000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `DESCRIPTION_` varchar(4000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `HAS_START_FORM_KEY_` tinyint(4) DEFAULT NULL,
  `HAS_GRAPHICAL_NOTATION_` tinyint(4) DEFAULT NULL,
  `SUSPENSION_STATE_` int(11) DEFAULT NULL,
  `TENANT_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `ENGINE_VERSION_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `FORM_KEY_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `STARTABLE_` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`ID_`),
  UNIQUE KEY `ACT_UNIQ_PROCDEF` (`KEY_`,`VERSION_`,`TENANT_ID_`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- 流程实例表
CREATE TABLE IF NOT EXISTS `act_ru_execution` (
  `ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `REV_` int(11) DEFAULT NULL,
  `PROC_INST_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `BUSINESS_KEY_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `PARENT_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `PROC_DEF_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `SUPER_EXEC_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ACT_ID_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `IS_ACTIVE_` tinyint(4) DEFAULT NULL,
  `IS_CONCURRENT_` tinyint(4) DEFAULT NULL,
  `IS_SCOPE_` tinyint(4) DEFAULT NULL,
  `IS_EVENT_SCOPE_` tinyint(4) DEFAULT NULL,
  `SUSPENSION_STATE_` int(11) DEFAULT NULL,
  `CACHED_ENT_STATE_` int(11) DEFAULT NULL,
  `TENANT_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `NAME_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `LOCK_TIME_` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`ID_`),
  KEY `ACT_IDX_EXEC_BUSINESS_KEY` (`BUSINESS_KEY_`),
  KEY `ACT_IDX_EXECUTION_ROOT` (`PROC_INST_ID_`),
  KEY `ACT_IDX_EXEC_PARENT` (`PARENT_ID_`),
  KEY `ACT_IDX_EXEC_SUPER` (`SUPER_EXEC_`),
  KEY `ACT_IDX_EXEC_PROC_DEF` (`PROC_DEF_ID_`),
  KEY `ACT_IDX_EXEC_TENANT_ID` (`TENANT_ID_`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- 任务表
CREATE TABLE IF NOT EXISTS `act_ru_task` (
  `ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `REV_` int(11) DEFAULT NULL,
  `EXECUTION_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `PROC_INST_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `PROC_DEF_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `NAME_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `PARENT_TASK_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `DESCRIPTION_` varchar(4000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TASK_DEF_KEY_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `OWNER_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ASSIGNEE_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `DELEGATION_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `PRIORITY_` int(11) DEFAULT NULL,
  `CREATE_TIME_` timestamp NULL DEFAULT NULL,
  `DUE_DATE_` timestamp NULL DEFAULT NULL,
  `CATEGORY_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `SUSPENSION_STATE_` int(11) DEFAULT NULL,
  `TENANT_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `FORM_KEY_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `CLAIM_TIME_` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`ID_`),
  KEY `ACT_IDX_TASK_EXECUTION` (`EXECUTION_ID_`),
  KEY `ACT_IDX_TASK_PROCINST` (`PROC_INST_ID_`),
  KEY `ACT_IDX_TASK_PROCDEF` (`PROC_DEF_ID_`),
  KEY `ACT_IDX_TASK_ASSIGNEE` (`ASSIGNEE_`),
  KEY `ACT_IDX_TASK_CASE_EXECUTION` (`EXECUTION_ID_`),
  KEY `ACT_IDX_TASK_CASE_PROCINST` (`PROC_INST_ID_`),
  KEY `ACT_IDX_TASK_PARENT` (`PARENT_TASK_ID_`),
  KEY `ACT_IDX_TASK_TENANT_ID` (`TENANT_ID_`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- 流程变量表
CREATE TABLE IF NOT EXISTS `act_ru_variable` (
  `ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `REV_` int(11) DEFAULT NULL,
  `TYPE_` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `NAME_` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `EXECUTION_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `PROC_INST_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TASK_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `BYTES_` longblob,
  `DOUBLE_` double DEFAULT NULL,
  `LONG_` bigint(20) DEFAULT NULL,
  `TEXT_` varchar(4000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TEXT2_` varchar(4000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`ID_`),
  KEY `ACT_IDX_VAR_EXEC` (`EXECUTION_ID_`),
  KEY `ACT_IDX_VAR_PROCINST` (`PROC_INST_ID_`),
  KEY `ACT_IDX_VAR_TASK_ID` (`TASK_ID_`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- 身份链接表
CREATE TABLE IF NOT EXISTS `act_ru_identitylink` (
  `ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `REV_` int(11) DEFAULT NULL,
  `GROUP_ID_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TYPE_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `USER_ID_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TASK_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `CREATE_TIME_` timestamp NULL DEFAULT NULL,
  `PROC_INST_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`ID_`),
  KEY `ACT_IDX_IDENT_LNK_TASK` (`TASK_ID_`),
  KEY `ACT_IDX_IDENT_LNK_PROCINST` (`PROC_INST_ID_`),
  KEY `ACT_IDX_IDENT_LNK_USER` (`USER_ID_`),
  KEY `ACT_IDX_IDENT_LNK_GROUP` (`GROUP_ID_`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- 历史流程实例表
CREATE TABLE IF NOT EXISTS `act_hi_procinst` (
  `ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `PROC_INST_ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `BUSINESS_KEY_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `PROC_DEF_ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `START_TIME_` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `END_TIME_` timestamp NULL DEFAULT NULL,
  `DURATION_` bigint(20) DEFAULT NULL,
  `START_USER_ID_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `START_ACT_ID_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `END_ACT_ID_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `SUPER_PROCESS_INSTANCE_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `DELETE_REASON_` varchar(4000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TENANT_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '',
  PRIMARY KEY (`ID_`),
  UNIQUE KEY `ACT_UNIQ_HI_PROC_INST` (`PROC_INST_ID_`),
  KEY `ACT_IDX_HI_PRO_INST_END` (`END_TIME_`),
  KEY `ACT_IDX_HI_PRO_I_BUSKEY` (`BUSINESS_KEY_`),
  KEY `ACT_IDX_HI_PRO_INST_TENANT_ID` (`TENANT_ID_`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- 历史任务表
CREATE TABLE IF NOT EXISTS `act_hi_taskinst` (
  `ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `PROC_DEF_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TASK_DEF_KEY_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `PROC_INST_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `EXECUTION_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `NAME_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `PARENT_TASK_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `DESCRIPTION_` varchar(4000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `OWNER_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ASSIGNEE_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `START_TIME_` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `CLAIM_TIME_` timestamp NULL DEFAULT NULL,
  `END_TIME_` timestamp NULL DEFAULT NULL,
  `DURATION_` bigint(20) DEFAULT NULL,
  `DELETE_REASON_` varchar(4000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `PRIORITY_` int(11) DEFAULT NULL,
  `DUE_DATE_` timestamp NULL DEFAULT NULL,
  `CATEGORY_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TENANT_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '',
  PRIMARY KEY (`ID_`),
  KEY `ACT_IDX_HI_TASK_INST_PROCINST` (`PROC_INST_ID_`),
  KEY `ACT_IDX_HI_TASK_INST_END` (`END_TIME_`),
  KEY `ACT_IDX_HI_TASK_INST_ASSIGNEE` (`ASSIGNEE_`),
  KEY `ACT_IDX_HI_TASK_INST_TENANT_ID` (`TENANT_ID_`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- 历史活动表
CREATE TABLE IF NOT EXISTS `act_hi_actinst` (
  `ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `PROC_DEF_ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `PROC_INST_ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `EXECUTION_ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `ACT_ID_` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `TASK_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `CALL_PROC_INST_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ACT_NAME_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ACT_TYPE_` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `ASSIGNEE_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `START_TIME_` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `END_TIME_` timestamp NULL DEFAULT NULL,
  `DURATION_` bigint(20) DEFAULT NULL,
  `DELETE_REASON_` varchar(4000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TENANT_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '',
  PRIMARY KEY (`ID_`),
  KEY `ACT_IDX_HI_ACT_INST_START` (`START_TIME_`),
  KEY `ACT_IDX_HI_ACT_INST_END` (`END_TIME_`),
  KEY `ACT_IDX_HI_ACT_INST_PROCINST` (`PROC_INST_ID_`),
  KEY `ACT_IDX_HI_ACT_INST_EXEC` (`EXECUTION_ID_`),
  KEY `ACT_IDX_HI_ACT_INST_TENANT_ID` (`TENANT_ID_`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- 历史变量表
CREATE TABLE IF NOT EXISTS `act_hi_varinst` (
  `ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `PROC_INST_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `EXECUTION_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TASK_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `NAME_` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `REV_` int(11) DEFAULT NULL,
  `TYPE_` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `BYTES_` longblob,
  `DOUBLE_` double DEFAULT NULL,
  `LONG_` bigint(20) DEFAULT NULL,
  `TEXT_` varchar(4000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TEXT2_` varchar(4000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `CREATE_TIME_` timestamp NULL DEFAULT NULL,
  `LAST_UPDATED_TIME_` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`ID_`),
  KEY `ACT_IDX_HI_PROCVAR_PROCINST` (`PROC_INST_ID_`),
  KEY `ACT_IDX_HI_PROCVAR_TASK_ID` (`TASK_ID_`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- 历史身份链接表
CREATE TABLE IF NOT EXISTS `act_hi_identitylink` (
  `ID_` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `GROUP_ID_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TYPE_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `USER_ID_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `TASK_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `CREATE_TIME_` timestamp NULL DEFAULT NULL,
  `PROC_INST_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `SCOPE_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `SCOPE_TYPE_` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `SCOPE_DEFINITION_ID_` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`ID_`),
  KEY `ACT_IDX_HI_IDENT_LNK_TASK` (`TASK_ID_`),
  KEY `ACT_IDX_HI_IDENT_LNK_PROCINST` (`PROC_INST_ID_`),
  KEY `ACT_IDX_HI_IDENT_LNK_SCOPE` (`SCOPE_ID_`,`SCOPE_TYPE_`),
  KEY `ACT_IDX_HI_IDENT_LNK_SUB_SCOPE` (`SCOPE_ID_`,`SCOPE_TYPE_`,`TYPE_`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

SET FOREIGN_KEY_CHECKS = 1;