-- ----------------------------
-- Table structure for base_handlername
-- ----------------------------
DROP TABLE IF EXISTS "public"."base_handlername";
CREATE TABLE "public"."base_handlername" (
  "f_id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "f_handlername" varchar(50) COLLATE "pg_catalog"."default",
  "f_executor" varchar(50) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."base_handlername"."f_id" IS '主键';
COMMENT ON COLUMN "public"."base_handlername"."f_handlername" IS '任务名称';
COMMENT ON COLUMN "public"."base_handlername"."f_executor" IS '执行器名称';

-- ----------------------------
-- Records of base_handlername
-- ----------------------------

-- ----------------------------
-- Table structure for base_timetask
-- ----------------------------
DROP TABLE IF EXISTS "public"."base_timetask";
CREATE TABLE "public"."base_timetask" (
  "f_id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "f_encode" varchar(50) COLLATE "pg_catalog"."default",
  "f_fullname" varchar(100) COLLATE "pg_catalog"."default",
  "f_executetype" varchar(50) COLLATE "pg_catalog"."default",
  "f_executecontent" text COLLATE "pg_catalog"."default",
  "f_executecyclejson" text COLLATE "pg_catalog"."default",
  "f_lastruntime" timestamp(6),
  "f_nextruntime" timestamp(6),
  "f_runcount" int4,
  "f_description" text COLLATE "pg_catalog"."default",
  "f_sortcode" int8,
  "f_enabledmark" int4,
  "f_creatortime" timestamp(6),
  "f_creatoruserid" varchar(50) COLLATE "pg_catalog"."default",
  "f_lastmodifytime" timestamp(6),
  "f_lastmodifyuserid" varchar(50) COLLATE "pg_catalog"."default",
  "f_deletemark" int4,
  "f_deletetime" timestamp(6),
  "f_deleteuserid" varchar(50) COLLATE "pg_catalog"."default",
  "f_executorname" varchar(50) COLLATE "pg_catalog"."default",
  "f_tenantid" varchar(50) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."base_timetask"."f_id" IS '自然主键';
COMMENT ON COLUMN "public"."base_timetask"."f_encode" IS '任务编码';
COMMENT ON COLUMN "public"."base_timetask"."f_fullname" IS '任务名称';
COMMENT ON COLUMN "public"."base_timetask"."f_executetype" IS '执行类型';
COMMENT ON COLUMN "public"."base_timetask"."f_executecontent" IS '执行内容';
COMMENT ON COLUMN "public"."base_timetask"."f_executecyclejson" IS '执行周期';
COMMENT ON COLUMN "public"."base_timetask"."f_lastruntime" IS '最后运行时间';
COMMENT ON COLUMN "public"."base_timetask"."f_nextruntime" IS '下次运行时间';
COMMENT ON COLUMN "public"."base_timetask"."f_runcount" IS '运行次数';
COMMENT ON COLUMN "public"."base_timetask"."f_description" IS '描述';
COMMENT ON COLUMN "public"."base_timetask"."f_sortcode" IS '排序';
COMMENT ON COLUMN "public"."base_timetask"."f_enabledmark" IS '有效标志';
COMMENT ON COLUMN "public"."base_timetask"."f_creatortime" IS '创建时间';
COMMENT ON COLUMN "public"."base_timetask"."f_creatoruserid" IS '创建用户';
COMMENT ON COLUMN "public"."base_timetask"."f_lastmodifytime" IS '修改时间';
COMMENT ON COLUMN "public"."base_timetask"."f_lastmodifyuserid" IS '修改用户';
COMMENT ON COLUMN "public"."base_timetask"."f_deletemark" IS '删除标志';
COMMENT ON COLUMN "public"."base_timetask"."f_deletetime" IS '删除时间';
COMMENT ON COLUMN "public"."base_timetask"."f_deleteuserid" IS '删除用户';
COMMENT ON COLUMN "public"."base_timetask"."f_executorname" IS '执行器名称';
COMMENT ON COLUMN "public"."base_timetask"."f_tenantid" IS '租户id';
COMMENT ON TABLE "public"."base_timetask" IS '定时任务';

-- ----------------------------
-- Records of base_timetask
-- ----------------------------

-- ----------------------------
-- Table structure for base_timetasklog
-- ----------------------------
DROP TABLE IF EXISTS "public"."base_timetasklog";
CREATE TABLE "public"."base_timetasklog" (
  "f_id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "f_taskid" varchar(50) COLLATE "pg_catalog"."default",
  "f_runtime" timestamp(6),
  "f_runresult" int4,
  "f_description" text COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."base_timetasklog"."f_id" IS '自然主键';
COMMENT ON COLUMN "public"."base_timetasklog"."f_taskid" IS '定时任务主键';
COMMENT ON COLUMN "public"."base_timetasklog"."f_runtime" IS '执行时间';
COMMENT ON COLUMN "public"."base_timetasklog"."f_runresult" IS '执行结果';
COMMENT ON COLUMN "public"."base_timetasklog"."f_description" IS '执行说明';
COMMENT ON TABLE "public"."base_timetasklog" IS '定时任务记录';

-- ----------------------------
-- Records of base_timetasklog
-- ----------------------------

-- ----------------------------
-- Table structure for xxl_job_group
-- ----------------------------
DROP TABLE IF EXISTS "public"."xxl_job_group";
CREATE TABLE "public"."xxl_job_group" (
  "id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "app_name" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "title" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "address_type" int2 NOT NULL,
  "address_list" text COLLATE "pg_catalog"."default",
  "update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."xxl_job_group"."app_name" IS '执行器AppName';
COMMENT ON COLUMN "public"."xxl_job_group"."title" IS '执行器名称';
COMMENT ON COLUMN "public"."xxl_job_group"."address_type" IS '执行器地址类型：0=自动注册、1=手动录入';
COMMENT ON COLUMN "public"."xxl_job_group"."address_list" IS '执行器地址列表，多地址逗号分隔';

-- ----------------------------
-- Records of xxl_job_group
-- ----------------------------
INSERT INTO "public"."xxl_job_group" VALUES ('8', 'xxl-job-executor-sample1', 'xxl-job-executor-sample1', 0, 'http://192.168.20.116:9999/', '2022-12-12 14:28:53');

-- ----------------------------
-- Table structure for xxl_job_info
-- ----------------------------
DROP TABLE IF EXISTS "public"."xxl_job_info";
CREATE TABLE "public"."xxl_job_info" (
  "id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "job_group" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "job_desc" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "add_time" timestamp(6),
  "update_time" timestamp(6),
  "author" varchar(64) COLLATE "pg_catalog"."default",
  "alarm_email" varchar(255) COLLATE "pg_catalog"."default",
  "schedule_type" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "schedule_conf" varchar(128) COLLATE "pg_catalog"."default",
  "misfire_strategy" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "executor_route_strategy" varchar(50) COLLATE "pg_catalog"."default",
  "executor_handler" varchar(255) COLLATE "pg_catalog"."default",
  "executor_param" text COLLATE "pg_catalog"."default",
  "executor_block_strategy" varchar(50) COLLATE "pg_catalog"."default",
  "executor_timeout" int4 NOT NULL,
  "executor_fail_retry_count" int4 NOT NULL,
  "glue_type" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "glue_source" text COLLATE "pg_catalog"."default",
  "glue_remark" varchar(128) COLLATE "pg_catalog"."default",
  "glue_updatetime" timestamp(6),
  "child_jobid" varchar(255) COLLATE "pg_catalog"."default",
  "trigger_status" int2 NOT NULL,
  "trigger_last_time" int8 NOT NULL,
  "trigger_next_time" int8 NOT NULL,
  "tenantid" varchar(50) COLLATE "pg_catalog"."default",
  "taskid" varchar(50) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."xxl_job_info"."job_group" IS '执行器主键ID';
COMMENT ON COLUMN "public"."xxl_job_info"."author" IS '作者';
COMMENT ON COLUMN "public"."xxl_job_info"."alarm_email" IS '报警邮件';
COMMENT ON COLUMN "public"."xxl_job_info"."schedule_type" IS '调度类型';
COMMENT ON COLUMN "public"."xxl_job_info"."schedule_conf" IS '调度配置，值含义取决于调度类型';
COMMENT ON COLUMN "public"."xxl_job_info"."misfire_strategy" IS '调度过期策略';
COMMENT ON COLUMN "public"."xxl_job_info"."executor_route_strategy" IS '执行器路由策略';
COMMENT ON COLUMN "public"."xxl_job_info"."executor_handler" IS '执行器任务handler';
COMMENT ON COLUMN "public"."xxl_job_info"."executor_param" IS '执行器任务参数';
COMMENT ON COLUMN "public"."xxl_job_info"."executor_block_strategy" IS '阻塞处理策略';
COMMENT ON COLUMN "public"."xxl_job_info"."executor_timeout" IS '任务执行超时时间，单位秒';
COMMENT ON COLUMN "public"."xxl_job_info"."executor_fail_retry_count" IS '失败重试次数';
COMMENT ON COLUMN "public"."xxl_job_info"."glue_type" IS 'GLUE类型';
COMMENT ON COLUMN "public"."xxl_job_info"."glue_source" IS 'GLUE源代码';
COMMENT ON COLUMN "public"."xxl_job_info"."glue_remark" IS 'GLUE备注';
COMMENT ON COLUMN "public"."xxl_job_info"."glue_updatetime" IS 'GLUE更新时间';
COMMENT ON COLUMN "public"."xxl_job_info"."child_jobid" IS '子任务ID，多个逗号分隔';
COMMENT ON COLUMN "public"."xxl_job_info"."trigger_status" IS '调度状态：0-停止，1-运行';
COMMENT ON COLUMN "public"."xxl_job_info"."trigger_last_time" IS '上次调度时间';
COMMENT ON COLUMN "public"."xxl_job_info"."trigger_next_time" IS '下次调度时间';
COMMENT ON COLUMN "public"."xxl_job_info"."tenantid" IS '租户编码';
COMMENT ON COLUMN "public"."xxl_job_info"."taskid" IS '任务id';

-- ----------------------------
-- Records of xxl_job_info
-- ----------------------------

-- ----------------------------
-- Table structure for xxl_job_lock
-- ----------------------------
DROP TABLE IF EXISTS "public"."xxl_job_lock";
CREATE TABLE "public"."xxl_job_lock" (
  "lock_name" varchar(50) COLLATE "pg_catalog"."default" NOT NULL
)
;
COMMENT ON COLUMN "public"."xxl_job_lock"."lock_name" IS '锁名称';

-- ----------------------------
-- Records of xxl_job_lock
-- ----------------------------
INSERT INTO "public"."xxl_job_lock" VALUES ('schedule_lock');

-- ----------------------------
-- Table structure for xxl_job_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."xxl_job_log";
CREATE TABLE "public"."xxl_job_log" (
  "id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "job_group" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "job_id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "executor_address" varchar(255) COLLATE "pg_catalog"."default",
  "executor_handler" varchar(255) COLLATE "pg_catalog"."default",
  "executor_param" text COLLATE "pg_catalog"."default",
  "executor_sharding_param" varchar(20) COLLATE "pg_catalog"."default",
  "executor_fail_retry_count" int4 NOT NULL,
  "trigger_time" timestamp(6),
  "trigger_code" int4 NOT NULL,
  "trigger_msg" text COLLATE "pg_catalog"."default",
  "handle_time" timestamp(6),
  "handle_code" int4 NOT NULL,
  "handle_msg" text COLLATE "pg_catalog"."default",
  "alarm_status" int2 NOT NULL
)
;
COMMENT ON COLUMN "public"."xxl_job_log"."job_group" IS '执行器主键ID';
COMMENT ON COLUMN "public"."xxl_job_log"."job_id" IS '任务，主键ID';
COMMENT ON COLUMN "public"."xxl_job_log"."executor_address" IS '执行器地址，本次执行的地址';
COMMENT ON COLUMN "public"."xxl_job_log"."executor_handler" IS '执行器任务handler';
COMMENT ON COLUMN "public"."xxl_job_log"."executor_param" IS '执行器任务参数';
COMMENT ON COLUMN "public"."xxl_job_log"."executor_sharding_param" IS '执行器任务分片参数，格式如 1/2';
COMMENT ON COLUMN "public"."xxl_job_log"."executor_fail_retry_count" IS '失败重试次数';
COMMENT ON COLUMN "public"."xxl_job_log"."trigger_time" IS '调度-时间';
COMMENT ON COLUMN "public"."xxl_job_log"."trigger_code" IS '调度-结果';
COMMENT ON COLUMN "public"."xxl_job_log"."trigger_msg" IS '调度-日志';
COMMENT ON COLUMN "public"."xxl_job_log"."handle_time" IS '执行-时间';
COMMENT ON COLUMN "public"."xxl_job_log"."handle_code" IS '执行-状态';
COMMENT ON COLUMN "public"."xxl_job_log"."handle_msg" IS '执行-日志';
COMMENT ON COLUMN "public"."xxl_job_log"."alarm_status" IS '告警状态：0-默认、1-无需告警、2-告警成功、3-告警失败';

-- ----------------------------
-- Records of xxl_job_log
-- ----------------------------

-- ----------------------------
-- Table structure for xxl_job_log_report
-- ----------------------------
DROP TABLE IF EXISTS "public"."xxl_job_log_report";
CREATE TABLE "public"."xxl_job_log_report" (
  "id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_day" timestamp(6),
  "running_count" int4 NOT NULL,
  "suc_count" int4 NOT NULL,
  "fail_count" int4 NOT NULL,
  "update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."xxl_job_log_report"."trigger_day" IS '调度-时间';
COMMENT ON COLUMN "public"."xxl_job_log_report"."running_count" IS '运行中-日志数量';
COMMENT ON COLUMN "public"."xxl_job_log_report"."suc_count" IS '执行成功-日志数量';
COMMENT ON COLUMN "public"."xxl_job_log_report"."fail_count" IS '执行失败-日志数量';

-- ----------------------------
-- Records of xxl_job_log_report
-- ----------------------------
INSERT INTO "public"."xxl_job_log_report" VALUES ('1602187341432389633', '2022-12-12 00:00:00', 0, 0, 0, NULL);
INSERT INTO "public"."xxl_job_log_report" VALUES ('1602187341746962434', '2022-12-11 00:00:00', 0, 0, 0, NULL);
INSERT INTO "public"."xxl_job_log_report" VALUES ('1602187342342553602', '2022-12-10 00:00:00', 0, 0, 0, NULL);

-- ----------------------------
-- Table structure for xxl_job_logglue
-- ----------------------------
DROP TABLE IF EXISTS "public"."xxl_job_logglue";
CREATE TABLE "public"."xxl_job_logglue" (
  "id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "job_id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "glue_type" varchar(50) COLLATE "pg_catalog"."default",
  "glue_source" text COLLATE "pg_catalog"."default",
  "glue_remark" varchar(128) COLLATE "pg_catalog"."default" NOT NULL,
  "add_time" timestamp(6),
  "update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."xxl_job_logglue"."job_id" IS '任务，主键ID';
COMMENT ON COLUMN "public"."xxl_job_logglue"."glue_type" IS 'GLUE类型';
COMMENT ON COLUMN "public"."xxl_job_logglue"."glue_source" IS 'GLUE源代码';
COMMENT ON COLUMN "public"."xxl_job_logglue"."glue_remark" IS 'GLUE备注';

-- ----------------------------
-- Records of xxl_job_logglue
-- ----------------------------

-- ----------------------------
-- Table structure for xxl_job_registry
-- ----------------------------
DROP TABLE IF EXISTS "public"."xxl_job_registry";
CREATE TABLE "public"."xxl_job_registry" (
  "id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "registry_group" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "registry_key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "registry_value" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "update_time" timestamp(6)
)
;

-- ----------------------------
-- Records of xxl_job_registry
-- ----------------------------
INSERT INTO "public"."xxl_job_registry" VALUES ('1602187332896980993', 'EXECUTOR', 'xxl-job-executor-sample1', 'http://192.168.20.116:9999/', '2022-12-12 14:28:52');

-- ----------------------------
-- Table structure for xxl_job_user
-- ----------------------------
DROP TABLE IF EXISTS "public"."xxl_job_user";
CREATE TABLE "public"."xxl_job_user" (
  "id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "username" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "password" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "role" int2 NOT NULL,
  "permission" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."xxl_job_user"."username" IS '账号';
COMMENT ON COLUMN "public"."xxl_job_user"."password" IS '密码';
COMMENT ON COLUMN "public"."xxl_job_user"."role" IS '角色：0-普通用户、1-管理员';
COMMENT ON COLUMN "public"."xxl_job_user"."permission" IS '权限：执行器ID列表，多个逗号分割';

-- ----------------------------
-- Records of xxl_job_user
-- ----------------------------
INSERT INTO "public"."xxl_job_user" VALUES ('1', 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL);

-- ----------------------------
-- Primary Key structure for table base_handlername
-- ----------------------------
ALTER TABLE "public"."base_handlername" ADD CONSTRAINT "base_handlername_pkey" PRIMARY KEY ("f_id");

-- ----------------------------
-- Primary Key structure for table base_timetask
-- ----------------------------
ALTER TABLE "public"."base_timetask" ADD CONSTRAINT "base_timetask_pkey" PRIMARY KEY ("f_id");

-- ----------------------------
-- Primary Key structure for table base_timetasklog
-- ----------------------------
ALTER TABLE "public"."base_timetasklog" ADD CONSTRAINT "base_timetasklog_pkey" PRIMARY KEY ("f_id");

-- ----------------------------
-- Primary Key structure for table xxl_job_group
-- ----------------------------
ALTER TABLE "public"."xxl_job_group" ADD CONSTRAINT "xxl_job_group_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table xxl_job_info
-- ----------------------------
ALTER TABLE "public"."xxl_job_info" ADD CONSTRAINT "xxl_job_info_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table xxl_job_lock
-- ----------------------------
ALTER TABLE "public"."xxl_job_lock" ADD CONSTRAINT "xxl_job_lock_pkey" PRIMARY KEY ("lock_name");

-- ----------------------------
-- Indexes structure for table xxl_job_log
-- ----------------------------
CREATE INDEX "i_handle_code" ON "public"."xxl_job_log" USING btree (
  "handle_code" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "i_job_id" ON "public"."xxl_job_log" USING btree (
  "job_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
  "trigger_time" "pg_catalog"."timestamp_ops" ASC NULLS LAST
);
CREATE INDEX "i_trigger_time" ON "public"."xxl_job_log" USING btree (
  "trigger_time" "pg_catalog"."timestamp_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table xxl_job_log
-- ----------------------------
ALTER TABLE "public"."xxl_job_log" ADD CONSTRAINT "xxl_job_log_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table xxl_job_log_report
-- ----------------------------
CREATE INDEX "i_trigger_day" ON "public"."xxl_job_log_report" USING btree (
  "trigger_day" "pg_catalog"."timestamp_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table xxl_job_log_report
-- ----------------------------
ALTER TABLE "public"."xxl_job_log_report" ADD CONSTRAINT "xxl_job_log_report_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table xxl_job_logglue
-- ----------------------------
ALTER TABLE "public"."xxl_job_logglue" ADD CONSTRAINT "xxl_job_logglue_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table xxl_job_registry
-- ----------------------------
CREATE INDEX "i_g_k_v" ON "public"."xxl_job_registry" USING btree (
  "registry_group" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
  "registry_key" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
  "registry_value" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table xxl_job_registry
-- ----------------------------
ALTER TABLE "public"."xxl_job_registry" ADD CONSTRAINT "xxl_job_registry_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table xxl_job_user
-- ----------------------------
CREATE INDEX "i_username" ON "public"."xxl_job_user" USING btree (
  "username" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table xxl_job_user
-- ----------------------------
ALTER TABLE "public"."xxl_job_user" ADD CONSTRAINT "xxl_job_user_pkey" PRIMARY KEY ("id");
