-- platform2.xxl_job_group definition

CREATE TABLE `xxl_job_group` (
  `ID` bigint NOT NULL AUTO_INCREMENT,
  `APP_NAME` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `TITLE` varchar(12) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `ADDRESS_TYPE` tinyint NOT NULL DEFAULT '0',
  `ADDRESS_LIST` longtext COLLATE utf8mb4_general_ci COMMENT '执行器地址列表，多地址逗号分隔',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新日期',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='JOB 组表';


-- platform2.xxl_job_info definition

CREATE TABLE `xxl_job_info` (
  `ID` bigint NOT NULL AUTO_INCREMENT,
  `JOB_GROUP` int NOT NULL,
  `JOB_DESC` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `ADD_TIME` datetime DEFAULT NULL COMMENT '创建日期',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新日期',
  `AUTHOR` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '作者',
  `ALARM_EMAIL` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '报警邮件',
  `SCHEDULE_TYPE` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'NONE',
  `SCHEDULE_CONF` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '调度配置，值含义取决于调度类型',
  `MISFIRE_STRATEGY` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'DO_NOTHING',
  `EXECUTOR_ROUTE_STRATEGY` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '执行器路由策略',
  `EXECUTOR_HANDLER` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '执行器任务handler',
  `EXECUTOR_PARAM` varchar(512) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '执行器任务参数',
  `EXECUTOR_BLOCK_STRATEGY` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '阻塞处理策略',
  `EXECUTOR_TIMEOUT` int NOT NULL DEFAULT '0',
  `EXECUTOR_FAIL_RETRY_COUNT` int NOT NULL DEFAULT '0',
  `GLUE_TYPE` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'GLUE类型',
  `GLUE_SOURCE` longtext COLLATE utf8mb4_general_ci COMMENT 'GLUE源代码',
  `GLUE_REMARK` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'GLUE备注',
  `GLUE_UPDATETIME` datetime DEFAULT NULL COMMENT 'GLUE更新时间',
  `CHILD_JOBID` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '子任务ID，多个逗号分隔',
  `TRIGGER_STATUS` tinyint NOT NULL DEFAULT '0',
  `TRIGGER_LAST_TIME` bigint NOT NULL DEFAULT '0',
  `TRIGGER_NEXT_TIME` bigint NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='JOB信息表';


-- platform2.xxl_job_lock definition

CREATE TABLE `xxl_job_lock` (
  `LOCK_NAME` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '锁名称',
  PRIMARY KEY (`LOCK_NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='JOB 锁表';


-- platform2.xxl_job_log definition

CREATE TABLE `xxl_job_log` (
  `ID` bigint NOT NULL AUTO_INCREMENT,
  `JOB_GROUP` int NOT NULL,
  `JOB_ID` int NOT NULL,
  `EXECUTOR_ADDRESS` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '执行器地址，本次执行的地址',
  `EXECUTOR_HANDLER` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '执行器任务handler',
  `EXECUTOR_PARAM` varchar(512) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '执行器任务参数',
  `EXECUTOR_SHARDING_PARAM` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '执行器任务分片参数，格式如 1/2',
  `EXECUTOR_FAIL_RETRY_COUNT` bigint NOT NULL DEFAULT '0',
  `TRIGGER_TIME` datetime DEFAULT NULL COMMENT '调度-时间',
  `TRIGGER_CODE` int NOT NULL,
  `TRIGGER_MSG` longtext COLLATE utf8mb4_general_ci COMMENT '调度-日志',
  `HANDLE_TIME` datetime DEFAULT NULL COMMENT '执行-时间',
  `HANDLE_CODE` int NOT NULL,
  `HANDLE_MSG` longtext COLLATE utf8mb4_general_ci COMMENT '执行-日志',
  `ALARM_STATUS` tinyint NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`),
  KEY `IDX_XXL_JOB_LOG_TRIGGER_TIME` (`TRIGGER_TIME`),
  KEY `IDX_XXL_JOB_LOG_HANDLE_CODE` (`HANDLE_CODE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='JOB日志表';


-- platform2.xxl_job_log_report definition

CREATE TABLE `xxl_job_log_report` (
  `ID` bigint NOT NULL AUTO_INCREMENT,
  `TRIGGER_DAY` datetime DEFAULT NULL COMMENT '调度-时间',
  `RUNNING_COUNT` int NOT NULL DEFAULT '0',
  `SUC_COUNT` int NOT NULL DEFAULT '0',
  `FAIL_COUNT` int NOT NULL DEFAULT '0',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新日期',
  PRIMARY KEY (`ID`),
  UNIQUE KEY `IDX_XXL_JOB_LOG_REPORT_TRIGGER_DAY` (`TRIGGER_DAY`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='JOB日志报告表';


-- platform2.xxl_job_logglue definition

CREATE TABLE `xxl_job_logglue` (
  `ID` bigint NOT NULL AUTO_INCREMENT,
  `JOB_ID` int NOT NULL,
  `GLUE_TYPE` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'GLUE类型',
  `GLUE_SOURCE` longtext COLLATE utf8mb4_general_ci COMMENT 'GLUE源代码',
  `GLUE_REMARK` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'GLUE备注',
  `ADD_TIME` datetime DEFAULT NULL COMMENT '创建日期',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新日期',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='JOB GLUE 表';


-- platform2.xxl_job_registry definition

CREATE TABLE `xxl_job_registry` (
  `ID` bigint NOT NULL AUTO_INCREMENT,
  `REGISTRY_GROUP` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `REGISTRY_KEY` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `REGISTRY_VALUE` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新日期',
  PRIMARY KEY (`ID`),
  UNIQUE KEY `REGISTRY_GROUP` (`REGISTRY_GROUP`,`REGISTRY_KEY`,`REGISTRY_VALUE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='JOB 注册表';


-- platform2.xxl_job_user definition

CREATE TABLE `xxl_job_user` (
  `ID` bigint NOT NULL AUTO_INCREMENT,
  `USERNAME` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `PASSWORD` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `ROLE` tinyint NOT NULL,
  `PERMISSION` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '权限：执行器ID列表，多个逗号分割',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='JOB 用户表';