drop table if exists sp_action;

CREATE TABLE `sp_action` (
  `id` varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '主键',
  `is_enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否启用',
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已删除',
  `created_by` varchar(32) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建人',
  `created_time` datetime DEFAULT NULL COMMENT '创建时间',
  `updated_by` varchar(32) CHARACTER SET utf8 DEFAULT NULL COMMENT '更新人',
  `updated_time` datetime DEFAULT NULL COMMENT '更新时间',
  `label` varchar(128) CHARACTER SET utf8 NOT NULL COMMENT '活动名称',
  `is_internal_service` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否内部服务',
  `service_name` varchar(32) CHARACTER SET utf8 DEFAULT NULL COMMENT '内部服务名称',
  `service_url` varchar(512) CHARACTER SET utf8 NOT NULL COMMENT '服务地址',
  `http_method` varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '请求类型 GET;POST;',
  `req_body` text CHARACTER SET utf8 COMMENT '请求参数模板',
  `tenant_id` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT 'NK' COMMENT '租户',
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_sp_act` (`tenant_id`,`label`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='拦截活动定义';