drop table if exists sp_def_event_auth;

CREATE TABLE `sp_def_event_auth` (
  `id` varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '主键',
  `sp_id` varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '状态流程定义',
  `event_id` varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '事件定义',
  `authority` varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '授权（角色）',
  `tenant_id` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT 'NK' COMMENT '租户',
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_event_auth` (`sp_id`,`event_id`,`authority`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='事件角色定义';