tables_xxl_job_postgres.sql 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. CREATE SEQUENCE "xxl_job_group_id_seq"
  2. INCREMENT 1
  3. MINVALUE 1
  4. MAXVALUE 2147483647
  5. START 1
  6. CACHE 1;
  7. SELECT setval('"xxl_job_group_id_seq"', 2, true);
  8. CREATE SEQUENCE "xxl_job_info_id_seq"
  9. INCREMENT 1
  10. MINVALUE 1
  11. MAXVALUE 2147483647
  12. START 1
  13. CACHE 1;
  14. CREATE SEQUENCE "xxl_job_log_id_seq"
  15. INCREMENT 1
  16. MINVALUE 1
  17. MAXVALUE 2147483647
  18. START 1
  19. CACHE 1;
  20. CREATE SEQUENCE "xxl_job_logglue_id_seq"
  21. INCREMENT 1
  22. MINVALUE 1
  23. MAXVALUE 2147483647
  24. START 1
  25. CACHE 1;
  26. CREATE SEQUENCE "xxl_job_log_report_id_seq"
  27. INCREMENT 1
  28. MINVALUE 1
  29. MAXVALUE 2147483647
  30. START 1
  31. CACHE 1;
  32. CREATE SEQUENCE "xxl_job_registry_id_seq"
  33. INCREMENT 1
  34. MINVALUE 1
  35. MAXVALUE 2147483647
  36. START 1
  37. CACHE 1;
  38. CREATE SEQUENCE "xxl_job_user_id_seq"
  39. INCREMENT 1
  40. MINVALUE 1
  41. MAXVALUE 2147483647
  42. START 1
  43. CACHE 1;
  44. SELECT setval('"xxl_job_user_id_seq"', 2, true);
  45. CREATE TABLE "xxl_job_group" (
  46. "id" int4 NOT NULL DEFAULT nextval('xxl_job_group_id_seq'::regclass),
  47. "app_name" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  48. "title" varchar(12) COLLATE "pg_catalog"."default" NOT NULL,
  49. "address_type" int2 NOT NULL,
  50. "address_list" text COLLATE "pg_catalog"."default",
  51. "update_time" timestamp(6)
  52. )
  53. ;
  54. COMMENT ON COLUMN "xxl_job_group"."app_name" IS '执行器AppName';
  55. COMMENT ON COLUMN "xxl_job_group"."title" IS '执行器名称';
  56. COMMENT ON COLUMN "xxl_job_group"."address_type" IS '执行器地址类型:0=自动注册、1=手动录入';
  57. COMMENT ON COLUMN "xxl_job_group"."address_list" IS '执行器地址列表,多地址逗号分隔';
  58. CREATE TABLE "xxl_job_info" (
  59. "id" int4 NOT NULL DEFAULT nextval('xxl_job_info_id_seq'::regclass),
  60. "job_group" int4 NOT NULL,
  61. "job_desc" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  62. "add_time" timestamp(6),
  63. "update_time" timestamp(6),
  64. "author" varchar(64) COLLATE "pg_catalog"."default",
  65. "alarm_email" varchar(255) COLLATE "pg_catalog"."default",
  66. "schedule_type" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  67. "schedule_conf" varchar(128) COLLATE "pg_catalog"."default",
  68. "misfire_strategy" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  69. "executor_route_strategy" varchar(50) COLLATE "pg_catalog"."default",
  70. "executor_handler" varchar(255) COLLATE "pg_catalog"."default",
  71. "executor_param" varchar(512) COLLATE "pg_catalog"."default",
  72. "executor_block_strategy" varchar(50) COLLATE "pg_catalog"."default",
  73. "executor_timeout" int4 NOT NULL,
  74. "executor_fail_retry_count" int4 NOT NULL,
  75. "glue_type" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  76. "glue_source" text COLLATE "pg_catalog"."default",
  77. "glue_remark" varchar(128) COLLATE "pg_catalog"."default",
  78. "glue_updatetime" timestamp(6),
  79. "child_jobid" varchar(255) COLLATE "pg_catalog"."default",
  80. "trigger_status" int2 NOT NULL,
  81. "trigger_last_time" int8 NOT NULL,
  82. "trigger_next_time" int8 NOT NULL
  83. )
  84. ;
  85. COMMENT ON COLUMN "xxl_job_info"."job_group" IS '执行器主键ID';
  86. COMMENT ON COLUMN "xxl_job_info"."author" IS '作者';
  87. COMMENT ON COLUMN "xxl_job_info"."alarm_email" IS '报警邮件';
  88. COMMENT ON COLUMN "xxl_job_info"."schedule_type" IS '调度类型';
  89. COMMENT ON COLUMN "xxl_job_info"."schedule_conf" IS '调度配置,值含义取决于调度类型';
  90. COMMENT ON COLUMN "xxl_job_info"."misfire_strategy" IS '调度过期策略';
  91. COMMENT ON COLUMN "xxl_job_info"."executor_route_strategy" IS '执行器路由策略';
  92. COMMENT ON COLUMN "xxl_job_info"."executor_handler" IS '执行器任务handler';
  93. COMMENT ON COLUMN "xxl_job_info"."executor_param" IS '执行器任务参数';
  94. COMMENT ON COLUMN "xxl_job_info"."executor_block_strategy" IS '阻塞处理策略';
  95. COMMENT ON COLUMN "xxl_job_info"."executor_timeout" IS '任务执行超时时间,单位秒';
  96. COMMENT ON COLUMN "xxl_job_info"."executor_fail_retry_count" IS '失败重试次数';
  97. COMMENT ON COLUMN "xxl_job_info"."glue_type" IS 'GLUE类型';
  98. COMMENT ON COLUMN "xxl_job_info"."glue_source" IS 'GLUE源代码';
  99. COMMENT ON COLUMN "xxl_job_info"."glue_remark" IS 'GLUE备注';
  100. COMMENT ON COLUMN "xxl_job_info"."glue_updatetime" IS 'GLUE更新时间';
  101. COMMENT ON COLUMN "xxl_job_info"."child_jobid" IS '子任务ID,多个逗号分隔';
  102. COMMENT ON COLUMN "xxl_job_info"."trigger_status" IS '调度状态:0-停止,1-运行';
  103. COMMENT ON COLUMN "xxl_job_info"."trigger_last_time" IS '上次调度时间';
  104. COMMENT ON COLUMN "xxl_job_info"."trigger_next_time" IS '下次调度时间';
  105. CREATE TABLE "xxl_job_lock" (
  106. "lock_name" varchar(50) COLLATE "pg_catalog"."default" NOT NULL
  107. )
  108. ;
  109. COMMENT ON COLUMN "xxl_job_lock"."lock_name" IS '锁名称';
  110. CREATE TABLE "xxl_job_log" (
  111. "id" int4 NOT NULL DEFAULT nextval('xxl_job_log_id_seq'::regclass),
  112. "job_group" int4 NOT NULL,
  113. "job_id" int4 NOT NULL,
  114. "executor_address" varchar(255) COLLATE "pg_catalog"."default",
  115. "executor_handler" varchar(255) COLLATE "pg_catalog"."default",
  116. "executor_param" varchar(512) COLLATE "pg_catalog"."default",
  117. "executor_sharding_param" varchar(20) COLLATE "pg_catalog"."default",
  118. "executor_fail_retry_count" int4 NOT NULL DEFAULT 0,
  119. "trigger_time" timestamp(6),
  120. "trigger_code" int4 NOT NULL,
  121. "trigger_msg" text COLLATE "pg_catalog"."default",
  122. "handle_time" timestamp(6),
  123. "handle_code" int4 NOT NULL,
  124. "handle_msg" text COLLATE "pg_catalog"."default",
  125. "alarm_status" int2 NOT NULL DEFAULT 0
  126. )
  127. ;
  128. COMMENT ON COLUMN "xxl_job_log"."job_group" IS '执行器主键ID';
  129. COMMENT ON COLUMN "xxl_job_log"."job_id" IS '任务,主键ID';
  130. COMMENT ON COLUMN "xxl_job_log"."executor_address" IS '执行器地址,本次执行的地址';
  131. COMMENT ON COLUMN "xxl_job_log"."executor_handler" IS '执行器任务handler';
  132. COMMENT ON COLUMN "xxl_job_log"."executor_param" IS '执行器任务参数';
  133. COMMENT ON COLUMN "xxl_job_log"."executor_sharding_param" IS '执行器任务分片参数,格式如 1/2';
  134. COMMENT ON COLUMN "xxl_job_log"."executor_fail_retry_count" IS '失败重试次数';
  135. COMMENT ON COLUMN "xxl_job_log"."trigger_time" IS '调度-时间';
  136. COMMENT ON COLUMN "xxl_job_log"."trigger_code" IS '调度-结果';
  137. COMMENT ON COLUMN "xxl_job_log"."trigger_msg" IS '调度-日志';
  138. COMMENT ON COLUMN "xxl_job_log"."handle_time" IS '执行-时间';
  139. COMMENT ON COLUMN "xxl_job_log"."handle_code" IS '执行-状态';
  140. COMMENT ON COLUMN "xxl_job_log"."handle_msg" IS '执行-日志';
  141. COMMENT ON COLUMN "xxl_job_log"."alarm_status" IS '告警状态:0-默认、1-无需告警、2-告警成功、3-告警失败';
  142. CREATE TABLE "xxl_job_log_report" (
  143. "id" int4 NOT NULL DEFAULT nextval('xxl_job_log_report_id_seq'::regclass),
  144. "trigger_day" timestamp(6),
  145. "running_count" int4 NOT NULL,
  146. "suc_count" int4 NOT NULL,
  147. "fail_count" int4 NOT NULL,
  148. "update_time" timestamp(6)
  149. )
  150. ;
  151. COMMENT ON COLUMN "xxl_job_log_report"."trigger_day" IS '调度-时间';
  152. COMMENT ON COLUMN "xxl_job_log_report"."running_count" IS '运行中-日志数量';
  153. COMMENT ON COLUMN "xxl_job_log_report"."suc_count" IS '执行成功-日志数量';
  154. COMMENT ON COLUMN "xxl_job_log_report"."fail_count" IS '执行失败-日志数量';
  155. CREATE TABLE "xxl_job_logglue" (
  156. "id" int4 NOT NULL DEFAULT nextval('xxl_job_logglue_id_seq'::regclass),
  157. "job_id" int4 NOT NULL,
  158. "glue_type" varchar(50) COLLATE "pg_catalog"."default",
  159. "glue_source" text COLLATE "pg_catalog"."default",
  160. "glue_remark" varchar(128) COLLATE "pg_catalog"."default" NOT NULL,
  161. "add_time" timestamp(6),
  162. "update_time" timestamp(6)
  163. )
  164. ;
  165. COMMENT ON COLUMN "xxl_job_logglue"."job_id" IS '任务,主键ID';
  166. COMMENT ON COLUMN "xxl_job_logglue"."glue_type" IS 'GLUE类型';
  167. COMMENT ON COLUMN "xxl_job_logglue"."glue_source" IS 'GLUE源代码';
  168. COMMENT ON COLUMN "xxl_job_logglue"."glue_remark" IS 'GLUE备注';
  169. CREATE TABLE "xxl_job_registry" (
  170. "id" int4 NOT NULL DEFAULT nextval('xxl_job_registry_id_seq'::regclass),
  171. "registry_group" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  172. "registry_key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  173. "registry_value" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  174. "update_time" timestamp(6)
  175. )
  176. ;
  177. CREATE TABLE "xxl_job_user" (
  178. "id" int4 NOT NULL DEFAULT nextval('xxl_job_user_id_seq'::regclass),
  179. "username" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  180. "password" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  181. "role" int2 NOT NULL,
  182. "permission" varchar(255) COLLATE "pg_catalog"."default"
  183. )
  184. ;
  185. COMMENT ON COLUMN "xxl_job_user"."username" IS '账号';
  186. COMMENT ON COLUMN "xxl_job_user"."password" IS '密码';
  187. COMMENT ON COLUMN "xxl_job_user"."role" IS '角色:0-普通用户、1-管理员';
  188. COMMENT ON COLUMN "xxl_job_user"."permission" IS '权限:执行器ID列表,多个逗号分割';
  189. ALTER TABLE "xxl_job_group" ADD CONSTRAINT "xxl_job_group_pkey" PRIMARY KEY ("id");
  190. ALTER TABLE "xxl_job_info" ADD CONSTRAINT "xxl_job_info_pkey" PRIMARY KEY ("id");
  191. ALTER TABLE "xxl_job_lock" ADD CONSTRAINT "xxl_job_lock_pkey" PRIMARY KEY ("lock_name");
  192. CREATE INDEX "I_handle_code" ON "xxl_job_log" USING btree (
  193. "handle_code" "pg_catalog"."int4_ops" ASC NULLS LAST
  194. );
  195. CREATE INDEX "I_trigger_time" ON "xxl_job_log" USING btree (
  196. "trigger_time" "pg_catalog"."timestamp_ops" ASC NULLS LAST
  197. );
  198. ALTER TABLE "xxl_job_log" ADD CONSTRAINT "xxl_job_log_pkey" PRIMARY KEY ("id");
  199. CREATE INDEX "i_trigger_day" ON "xxl_job_log_report" USING btree (
  200. "trigger_day" "pg_catalog"."timestamp_ops" ASC NULLS LAST
  201. );
  202. ALTER TABLE "xxl_job_log_report" ADD CONSTRAINT "xxl_job_log_report_pkey" PRIMARY KEY ("id");
  203. ALTER TABLE "xxl_job_logglue" ADD CONSTRAINT "xxl_job_logglue_pkey" PRIMARY KEY ("id");
  204. CREATE INDEX "i_g_k_v" ON "xxl_job_registry" USING btree (
  205. "registry_group" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
  206. "registry_key" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
  207. "registry_value" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
  208. );
  209. ALTER TABLE "xxl_job_registry" ADD CONSTRAINT "xxl_job_registry_pkey" PRIMARY KEY ("id");
  210. CREATE INDEX "i_username" ON "xxl_job_user" USING btree (
  211. "username" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
  212. );
  213. ALTER TABLE "xxl_job_user" ADD CONSTRAINT "xxl_job_user_pkey" PRIMARY KEY ("id");
  214. INSERT INTO "xxl_job_user" ("id", "username", "password", "role", "permission") VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL);
  215. INSERT INTO "xxl_job_group" ("id", "app_name", "title", "address_type", "address_list", "update_time") VALUES (1, 'xxl-job-executor', '执行器-测试组', 0, NULL, '2022-06-05 22:21:31');
  216. INSERT INTO "xxl_job_lock" ("lock_name") VALUES ('schedule_lock');