drop table if exists sp_def_event;

CREATE TABLE `sp_def_event` (
  `id` varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '主键',
  `sp_id` varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '状态流程定义',
  `source` varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '来源状态',
  `target` varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '目标状态',
  `label` varchar(128) CHARACTER SET utf8 DEFAULT NULL COMMENT '路由名称',
  `start_point` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '开始坐标',
  `end_point` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '结束坐标',
  `memo` varchar(512) CHARACTER SET utf8 DEFAULT NULL COMMENT '详细描述',
  `assignee` varchar(32) CHARACTER SET utf8 DEFAULT NULL COMMENT '受理人',
  `is_used_interceptor` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否启用拦截器',
  `is_visible` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否可见（在画布中显示）',
  `shape` varchar(20) CHARACTER SET utf8 NOT NULL COMMENT '图形样式',
  `is_any_to_any` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否AnyToAny',
  `tenant_id` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT 'NK' COMMENT '租户',
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_sp_event` (`sp_id`,`source`,`target`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='事件定义';