CREATE TABLE base_handlername (
	F_Id VARCHAR(150)   NOT NULL    PRIMARY KEY ,
	F_HandlerName VARCHAR(150)   NULL   ,
	F_Executor VARCHAR(150)   NULL   
) ;
COMMENT ON TABLE base_handlername IS '';
COMMENT ON COLUMN base_handlername.F_Id IS '主键';
COMMENT ON COLUMN base_handlername.F_HandlerName IS '任务名称';
COMMENT ON COLUMN base_handlername.F_Executor IS '执行器名称';
CREATE TABLE base_timetask (
	F_Id VARCHAR(150)   NOT NULL    PRIMARY KEY ,
	F_EnCode VARCHAR(150)   NULL   ,
	F_FullName VARCHAR(300)   NULL   ,
	F_ExecuteType VARCHAR(150)   NULL   ,
	F_ExecuteContent CLOB   NULL   ,
	F_ExecuteCycleJson CLOB   NULL   ,
	F_LastRunTime TIMESTAMP   NULL   ,
	F_NextRunTime TIMESTAMP   NULL   ,
	F_RunCount INT   NULL   ,
	F_Description CLOB   NULL   ,
	F_SortCode BIGINT   NULL   ,
	F_EnabledMark INT   NULL   ,
	F_CreatorTime TIMESTAMP   NULL   ,
	F_CreatorUserId VARCHAR(150)   NULL   ,
	F_LastModifyTime TIMESTAMP   NULL   ,
	F_LastModifyUserId VARCHAR(150)   NULL   ,
	F_DeleteMark INT   NULL   ,
	F_DeleteTime TIMESTAMP   NULL   ,
	F_DeleteUserId VARCHAR(150)   NULL   ,
	F_ExecutorName VARCHAR(150)   NULL   ,
	F_TenantId VARCHAR(150)   NULL   
) ;
COMMENT ON TABLE base_timetask IS '定时任务';
COMMENT ON COLUMN base_timetask.F_Id IS '自然主键';
COMMENT ON COLUMN base_timetask.F_EnCode IS '任务编码';
COMMENT ON COLUMN base_timetask.F_FullName IS '任务名称';
COMMENT ON COLUMN base_timetask.F_ExecuteType IS '执行类型';
COMMENT ON COLUMN base_timetask.F_ExecuteContent IS '执行内容';
COMMENT ON COLUMN base_timetask.F_ExecuteCycleJson IS '执行周期';
COMMENT ON COLUMN base_timetask.F_LastRunTime IS '最后运行时间';
COMMENT ON COLUMN base_timetask.F_NextRunTime IS '下次运行时间';
COMMENT ON COLUMN base_timetask.F_RunCount IS '运行次数';
COMMENT ON COLUMN base_timetask.F_Description IS '描述';
COMMENT ON COLUMN base_timetask.F_SortCode IS '排序';
COMMENT ON COLUMN base_timetask.F_EnabledMark IS '有效标志';
COMMENT ON COLUMN base_timetask.F_CreatorTime IS '创建时间';
COMMENT ON COLUMN base_timetask.F_CreatorUserId IS '创建用户';
COMMENT ON COLUMN base_timetask.F_LastModifyTime IS '修改时间';
COMMENT ON COLUMN base_timetask.F_LastModifyUserId IS '修改用户';
COMMENT ON COLUMN base_timetask.F_DeleteMark IS '删除标志';
COMMENT ON COLUMN base_timetask.F_DeleteTime IS '删除时间';
COMMENT ON COLUMN base_timetask.F_DeleteUserId IS '删除用户';
COMMENT ON COLUMN base_timetask.F_ExecutorName IS '执行器名称';
COMMENT ON COLUMN base_timetask.F_TenantId IS '租户id';
CREATE TABLE base_timetasklog (
	F_Id VARCHAR(150)   NOT NULL    PRIMARY KEY ,
	F_TaskId VARCHAR(150)   NULL   ,
	F_RunTime TIMESTAMP   NULL   ,
	F_RunResult INT   NULL   ,
	F_Description CLOB   NULL   
) ;
COMMENT ON TABLE base_timetasklog IS '定时任务记录';
COMMENT ON COLUMN base_timetasklog.F_Id IS '自然主键';
COMMENT ON COLUMN base_timetasklog.F_TaskId IS '定时任务主键';
COMMENT ON COLUMN base_timetasklog.F_RunTime IS '执行时间';
COMMENT ON COLUMN base_timetasklog.F_RunResult IS '执行结果';
COMMENT ON COLUMN base_timetasklog.F_Description IS '执行说明';
CREATE TABLE xxl_job_group (
	id VARCHAR(150)   NOT NULL    PRIMARY KEY ,
	app_name VARCHAR(192)   NOT NULL   ,
	title VARCHAR(192)   NOT NULL   ,
	address_type TINYINT   NOT NULL   ,
	address_list CLOB   NULL   ,
	update_time TIMESTAMP   NULL   
) ;
COMMENT ON TABLE xxl_job_group IS '';
COMMENT ON COLUMN xxl_job_group.id IS '';
COMMENT ON COLUMN xxl_job_group.app_name IS '执行器AppName';
COMMENT ON COLUMN xxl_job_group.title IS '执行器名称';
COMMENT ON COLUMN xxl_job_group.address_type IS '执行器地址类型：0=自动注册、1=手动录入';
COMMENT ON COLUMN xxl_job_group.address_list IS '执行器地址列表，多地址逗号分隔';
COMMENT ON COLUMN xxl_job_group.update_time IS '';
DELETE FROM xxl_job_group;
INSERT INTO xxl_job_group (app_name,update_time,address_type,address_list,id,title) VALUES ('xxl-job-executor-sample1','2022-12-12 18:13:35',0,'http://192.168.20.116:9999/','8','xxl-job-executor-sample1');
CREATE TABLE xxl_job_info (
	id VARCHAR(150)   NOT NULL    PRIMARY KEY ,
	job_group VARCHAR(150)   NOT NULL   ,
	job_desc VARCHAR(765)   NOT NULL   ,
	add_time TIMESTAMP   NULL   ,
	update_time TIMESTAMP   NULL   ,
	author VARCHAR(192)   NULL   ,
	alarm_email VARCHAR(765)   NULL   ,
	schedule_type VARCHAR(150)   NOT NULL   ,
	schedule_conf VARCHAR(384)   NULL   ,
	misfire_strategy VARCHAR(150)   NOT NULL   ,
	executor_route_strategy VARCHAR(150)   NULL   ,
	executor_handler VARCHAR(765)   NULL   ,
	executor_param CLOB   NULL   ,
	executor_block_strategy VARCHAR(150)   NULL   ,
	executor_timeout INT   NOT NULL   ,
	executor_fail_retry_count INT   NOT NULL   ,
	glue_type VARCHAR(150)   NOT NULL   ,
	glue_source CLOB   NULL   ,
	glue_remark VARCHAR(384)   NULL   ,
	glue_updatetime TIMESTAMP   NULL   ,
	child_jobid VARCHAR(765)   NULL   ,
	trigger_status TINYINT   NOT NULL   ,
	trigger_last_time BIGINT   NOT NULL   ,
	trigger_next_time BIGINT   NOT NULL   ,
	tenantId VARCHAR(150)   NULL   ,
	taskId VARCHAR(150)   NULL   
) ;
COMMENT ON TABLE xxl_job_info IS '';
COMMENT ON COLUMN xxl_job_info.id IS '';
COMMENT ON COLUMN xxl_job_info.job_group IS '执行器主键ID';
COMMENT ON COLUMN xxl_job_info.job_desc IS '';
COMMENT ON COLUMN xxl_job_info.add_time IS '';
COMMENT ON COLUMN xxl_job_info.update_time IS '';
COMMENT ON COLUMN xxl_job_info.author IS '作者';
COMMENT ON COLUMN xxl_job_info.alarm_email IS '报警邮件';
COMMENT ON COLUMN xxl_job_info.schedule_type IS '调度类型';
COMMENT ON COLUMN xxl_job_info.schedule_conf IS '调度配置，值含义取决于调度类型';
COMMENT ON COLUMN xxl_job_info.misfire_strategy IS '调度过期策略';
COMMENT ON COLUMN xxl_job_info.executor_route_strategy IS '执行器路由策略';
COMMENT ON COLUMN xxl_job_info.executor_handler IS '执行器任务handler';
COMMENT ON COLUMN xxl_job_info.executor_param IS '执行器任务参数';
COMMENT ON COLUMN xxl_job_info.executor_block_strategy IS '阻塞处理策略';
COMMENT ON COLUMN xxl_job_info.executor_timeout IS '任务执行超时时间，单位秒';
COMMENT ON COLUMN xxl_job_info.executor_fail_retry_count IS '失败重试次数';
COMMENT ON COLUMN xxl_job_info.glue_type IS 'GLUE类型';
COMMENT ON COLUMN xxl_job_info.glue_source IS 'GLUE源代码';
COMMENT ON COLUMN xxl_job_info.glue_remark IS 'GLUE备注';
COMMENT ON COLUMN xxl_job_info.glue_updatetime IS 'GLUE更新时间';
COMMENT ON COLUMN xxl_job_info.child_jobid IS '子任务ID，多个逗号分隔';
COMMENT ON COLUMN xxl_job_info.trigger_status IS '调度状态：0-停止，1-运行';
COMMENT ON COLUMN xxl_job_info.trigger_last_time IS '上次调度时间';
COMMENT ON COLUMN xxl_job_info.trigger_next_time IS '下次调度时间';
COMMENT ON COLUMN xxl_job_info.tenantId IS '租户编码';
COMMENT ON COLUMN xxl_job_info.taskId IS '任务id';
CREATE TABLE xxl_job_lock (
	lock_name VARCHAR(150)   NOT NULL    PRIMARY KEY 
) ;
COMMENT ON TABLE xxl_job_lock IS '';
COMMENT ON COLUMN xxl_job_lock.lock_name IS '锁名称';
DELETE FROM xxl_job_lock;
INSERT INTO xxl_job_lock (lock_name) VALUES ('schedule_lock');
CREATE TABLE xxl_job_log (
	id VARCHAR(150)   NOT NULL    PRIMARY KEY ,
	job_group VARCHAR(150)   NOT NULL   ,
	job_id VARCHAR(150)   NOT NULL   ,
	executor_address VARCHAR(765)   NULL   ,
	executor_handler VARCHAR(765)   NULL   ,
	executor_param CLOB   NULL   ,
	executor_sharding_param VARCHAR(60)   NULL   ,
	executor_fail_retry_count INT   NOT NULL   ,
	trigger_time TIMESTAMP   NULL   ,
	trigger_code INT   NOT NULL   ,
	trigger_msg CLOB   NULL   ,
	handle_time TIMESTAMP   NULL   ,
	handle_code INT   NOT NULL   ,
	handle_msg CLOB   NULL   ,
	alarm_status TINYINT   NOT NULL   
) ;
COMMENT ON TABLE xxl_job_log IS '';
COMMENT ON COLUMN xxl_job_log.id IS '';
COMMENT ON COLUMN xxl_job_log.job_group IS '执行器主键ID';
COMMENT ON COLUMN xxl_job_log.job_id IS '任务，主键ID';
COMMENT ON COLUMN xxl_job_log.executor_address IS '执行器地址，本次执行的地址';
COMMENT ON COLUMN xxl_job_log.executor_handler IS '执行器任务handler';
COMMENT ON COLUMN xxl_job_log.executor_param IS '执行器任务参数';
COMMENT ON COLUMN xxl_job_log.executor_sharding_param IS '执行器任务分片参数，格式如 1/2';
COMMENT ON COLUMN xxl_job_log.executor_fail_retry_count IS '失败重试次数';
COMMENT ON COLUMN xxl_job_log.trigger_time IS '调度-时间';
COMMENT ON COLUMN xxl_job_log.trigger_code IS '调度-结果';
COMMENT ON COLUMN xxl_job_log.trigger_msg IS '调度-日志';
COMMENT ON COLUMN xxl_job_log.handle_time IS '执行-时间';
COMMENT ON COLUMN xxl_job_log.handle_code IS '执行-状态';
COMMENT ON COLUMN xxl_job_log.handle_msg IS '执行-日志';
COMMENT ON COLUMN xxl_job_log.alarm_status IS '告警状态：0-默认、1-无需告警、2-告警成功、3-告警失败';
CREATE TABLE xxl_job_log_report (
	id VARCHAR(150)   NOT NULL    PRIMARY KEY ,
	trigger_day TIMESTAMP   NULL   ,
	running_count INT   NOT NULL   ,
	suc_count INT   NOT NULL   ,
	fail_count INT   NOT NULL   ,
	update_time TIMESTAMP   NULL   
) ;
COMMENT ON TABLE xxl_job_log_report IS '';
COMMENT ON COLUMN xxl_job_log_report.id IS '';
COMMENT ON COLUMN xxl_job_log_report.trigger_day IS '调度-时间';
COMMENT ON COLUMN xxl_job_log_report.running_count IS '运行中-日志数量';
COMMENT ON COLUMN xxl_job_log_report.suc_count IS '执行成功-日志数量';
COMMENT ON COLUMN xxl_job_log_report.fail_count IS '执行失败-日志数量';
COMMENT ON COLUMN xxl_job_log_report.update_time IS '';
DELETE FROM xxl_job_log_report;
INSERT INTO xxl_job_log_report (suc_count,update_time,running_count,id,trigger_day,fail_count) VALUES (0,Null,0,'1602187341432389633','2022-12-12 00:00:00',0);
INSERT INTO xxl_job_log_report (suc_count,update_time,running_count,id,trigger_day,fail_count) VALUES (0,Null,0,'1602187341746962434','2022-12-11 00:00:00',0);
INSERT INTO xxl_job_log_report (suc_count,update_time,running_count,id,trigger_day,fail_count) VALUES (0,Null,0,'1602187342342553602','2022-12-10 00:00:00',0);
CREATE TABLE xxl_job_logglue (
	id VARCHAR(150)   NOT NULL    PRIMARY KEY ,
	job_id VARCHAR(150)   NOT NULL   ,
	glue_type VARCHAR(150)   NULL   ,
	glue_source CLOB   NULL   ,
	glue_remark VARCHAR(384)   NOT NULL   ,
	add_time TIMESTAMP   NULL   ,
	update_time TIMESTAMP   NULL   
) ;
COMMENT ON TABLE xxl_job_logglue IS '';
COMMENT ON COLUMN xxl_job_logglue.id IS '';
COMMENT ON COLUMN xxl_job_logglue.job_id IS '任务，主键ID';
COMMENT ON COLUMN xxl_job_logglue.glue_type IS 'GLUE类型';
COMMENT ON COLUMN xxl_job_logglue.glue_source IS 'GLUE源代码';
COMMENT ON COLUMN xxl_job_logglue.glue_remark IS 'GLUE备注';
COMMENT ON COLUMN xxl_job_logglue.add_time IS '';
COMMENT ON COLUMN xxl_job_logglue.update_time IS '';
CREATE TABLE xxl_job_registry (
	id VARCHAR(150)   NOT NULL    PRIMARY KEY ,
	registry_group VARCHAR(150)   NOT NULL   ,
	registry_key VARCHAR(765)   NOT NULL   ,
	registry_value VARCHAR(765)   NOT NULL   ,
	update_time TIMESTAMP   NULL   
) ;
COMMENT ON TABLE xxl_job_registry IS '';
COMMENT ON COLUMN xxl_job_registry.id IS '';
COMMENT ON COLUMN xxl_job_registry.registry_group IS '';
COMMENT ON COLUMN xxl_job_registry.registry_key IS '';
COMMENT ON COLUMN xxl_job_registry.registry_value IS '';
COMMENT ON COLUMN xxl_job_registry.update_time IS '';
DELETE FROM xxl_job_registry;
INSERT INTO xxl_job_registry (registry_key,registry_value,update_time,id,registry_group) VALUES ('xxl-job-executor-sample1','http://192.168.20.116:9999/','2022-12-12 18:13:29','1602242852609622017','EXECUTOR');
CREATE TABLE xxl_job_user (
	id VARCHAR(150)   NOT NULL    PRIMARY KEY ,
	username VARCHAR(150)   NOT NULL   ,
	password VARCHAR(150)   NOT NULL   ,
	role TINYINT   NOT NULL   ,
	permission VARCHAR(765)   NULL   
) ;
COMMENT ON TABLE xxl_job_user IS '';
COMMENT ON COLUMN xxl_job_user.id IS '';
COMMENT ON COLUMN xxl_job_user.username IS '账号';
COMMENT ON COLUMN xxl_job_user.password IS '密码';
COMMENT ON COLUMN xxl_job_user.role IS '角色：0-普通用户、1-管理员';
COMMENT ON COLUMN xxl_job_user.permission IS '权限：执行器ID列表，多个逗号分割';
DELETE FROM xxl_job_user;
INSERT INTO xxl_job_user (password,role,permission,id,username) VALUES ('e10adc3949ba59abbe56e057f20f883e',1,Null,'1','admin');
