sql.txt 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. create table xxl_job_group
  2. (
  3. id bigint not null
  4. constraint xxl_job_group_pkey
  5. primary key,
  6. app_name varchar(64) not null,
  7. title varchar(12) not null,
  8. address_type smallint not null,
  9. address_list varchar(512)
  10. );
  11. comment on column xxl_job_group.app_name is '执行器AppName';
  12. comment on column xxl_job_group.title is '执行器名称';
  13. comment on column xxl_job_group.address_type is '执行器地址类型:0=自动注册、1=手动录入';
  14. comment on column xxl_job_group.address_list is '执行器地址列表,多地址逗号分隔';
  15. alter table xxl_job_group
  16. owner to postgres;
  17. create table xxl_job_info
  18. (
  19. id bigint not null
  20. constraint xxl_job_info_pkey
  21. primary key,
  22. job_group bigint not null,
  23. job_cron varchar(128) not null,
  24. job_desc varchar(255) not null,
  25. add_time timestamp(6),
  26. update_time timestamp(6),
  27. author varchar(64),
  28. alarm_email varchar(255),
  29. executor_route_strategy varchar(50),
  30. executor_handler varchar(255),
  31. executor_param varchar(512),
  32. executor_block_strategy varchar(50),
  33. executor_timeout integer not null,
  34. executor_fail_retry_count integer not null,
  35. glue_type varchar(50) not null,
  36. glue_source text,
  37. glue_remark varchar(128),
  38. glue_updatetime timestamp(6),
  39. child_jobid varchar(255),
  40. trigger_status smallint not null,
  41. trigger_last_time bigint not null,
  42. trigger_next_time bigint not null
  43. );
  44. comment on column xxl_job_info.job_group is '执行器主键ID';
  45. comment on column xxl_job_info.job_cron is '任务执行CRON';
  46. comment on column xxl_job_info.author is '作者';
  47. comment on column xxl_job_info.alarm_email is '报警邮件';
  48. comment on column xxl_job_info.executor_route_strategy is '执行器路由策略';
  49. comment on column xxl_job_info.executor_handler is '执行器任务handler';
  50. comment on column xxl_job_info.executor_param is '执行器任务参数';
  51. comment on column xxl_job_info.executor_block_strategy is '阻塞处理策略';
  52. comment on column xxl_job_info.executor_timeout is '任务执行超时时间,单位秒';
  53. comment on column xxl_job_info.executor_fail_retry_count is '失败重试次数';
  54. comment on column xxl_job_info.glue_type is 'GLUE类型';
  55. comment on column xxl_job_info.glue_source is 'GLUE源代码';
  56. comment on column xxl_job_info.glue_remark is 'GLUE备注';
  57. comment on column xxl_job_info.glue_updatetime is 'GLUE更新时间';
  58. comment on column xxl_job_info.child_jobid is '子任务ID,多个逗号分隔';
  59. comment on column xxl_job_info.trigger_status is '调度状态:0-停止,1-运行';
  60. comment on column xxl_job_info.trigger_last_time is '上次调度时间';
  61. comment on column xxl_job_info.trigger_next_time is '下次调度时间';
  62. alter table xxl_job_info
  63. owner to postgres;
  64. create table xxl_job_lock
  65. (
  66. lock_name varchar(50) not null
  67. constraint xxl_job_lock_pkey
  68. primary key
  69. );
  70. comment on column xxl_job_lock.lock_name is '锁名称';
  71. alter table xxl_job_lock
  72. owner to postgres;
  73. create table xxl_job_log
  74. (
  75. id bigint not null
  76. constraint xxl_job_log_pkey
  77. primary key,
  78. job_group bigint not null,
  79. job_id bigint not null,
  80. executor_address varchar(255),
  81. executor_handler varchar(255),
  82. executor_param varchar(512),
  83. executor_sharding_param varchar(20),
  84. executor_fail_retry_count integer not null,
  85. trigger_time timestamp(6),
  86. trigger_code integer not null,
  87. trigger_msg text,
  88. handle_time timestamp(6),
  89. handle_code integer not null,
  90. handle_msg text,
  91. alarm_status smallint not null
  92. );
  93. comment on column xxl_job_log.job_group is '执行器主键ID';
  94. comment on column xxl_job_log.job_id is '任务,主键ID';
  95. comment on column xxl_job_log.executor_address is '执行器地址,本次执行的地址';
  96. comment on column xxl_job_log.executor_handler is '执行器任务handler';
  97. comment on column xxl_job_log.executor_param is '执行器任务参数';
  98. comment on column xxl_job_log.executor_sharding_param is '执行器任务分片参数,格式如 1/2';
  99. comment on column xxl_job_log.executor_fail_retry_count is '失败重试次数';
  100. comment on column xxl_job_log.trigger_time is '调度-时间';
  101. comment on column xxl_job_log.trigger_code is '调度-结果';
  102. comment on column xxl_job_log.trigger_msg is '调度-日志';
  103. comment on column xxl_job_log.handle_time is '执行-时间';
  104. comment on column xxl_job_log.handle_code is '执行-状态';
  105. comment on column xxl_job_log.handle_msg is '执行-日志';
  106. comment on column xxl_job_log.alarm_status is '告警状态:0-默认、1-无需告警、2-告警成功、3-告警失败';
  107. alter table xxl_job_log
  108. owner to postgres;
  109. create index "I_handle_code"
  110. on xxl_job_log (handle_code);
  111. create index "I_trigger_time"
  112. on xxl_job_log (trigger_time);
  113. create table xxl_job_log_report
  114. (
  115. id bigint not null
  116. constraint xxl_job_log_report_pkey
  117. primary key,
  118. trigger_day timestamp(6),
  119. running_count integer not null,
  120. suc_count integer not null,
  121. fail_count integer not null
  122. );
  123. comment on column xxl_job_log_report.trigger_day is '调度-时间';
  124. comment on column xxl_job_log_report.running_count is '运行中-日志数量';
  125. comment on column xxl_job_log_report.suc_count is '执行成功-日志数量';
  126. comment on column xxl_job_log_report.fail_count is '执行失败-日志数量';
  127. alter table xxl_job_log_report
  128. owner to postgres;
  129. create index i_trigger_day
  130. on xxl_job_log_report (trigger_day);
  131. create table xxl_job_logglue
  132. (
  133. id bigint not null
  134. constraint xxl_job_logglue_pkey
  135. primary key,
  136. job_id bigint not null,
  137. glue_type varchar(50),
  138. glue_source text,
  139. glue_remark varchar(128) not null,
  140. add_time timestamp(6),
  141. update_time timestamp(6)
  142. );
  143. comment on column xxl_job_logglue.job_id is '任务,主键ID';
  144. comment on column xxl_job_logglue.glue_type is 'GLUE类型';
  145. comment on column xxl_job_logglue.glue_source is 'GLUE源代码';
  146. comment on column xxl_job_logglue.glue_remark is 'GLUE备注';
  147. alter table xxl_job_logglue
  148. owner to postgres;
  149. create table xxl_job_registry
  150. (
  151. id bigint not null
  152. constraint xxl_job_registry_pkey
  153. primary key,
  154. registry_group varchar(50) not null,
  155. registry_key varchar(255) not null,
  156. registry_value varchar(255) not null,
  157. update_time timestamp(6)
  158. );
  159. alter table xxl_job_registry
  160. owner to postgres;
  161. create index i_g_k_v
  162. on xxl_job_registry (registry_group, registry_key, registry_value);
  163. create table xxl_job_user
  164. (
  165. id bigint not null
  166. constraint xxl_job_user_pkey
  167. primary key,
  168. username varchar(50) not null,
  169. password varchar(50) not null,
  170. role smallint not null,
  171. permission varchar(255)
  172. );
  173. comment on column xxl_job_user.username is '账号';
  174. comment on column xxl_job_user.password is '密码';
  175. comment on column xxl_job_user.role is '角色:0-普通用户、1-管理员';
  176. comment on column xxl_job_user.permission is '权限:执行器ID列表,多个逗号分割';
  177. alter table xxl_job_user
  178. owner to postgres;
  179. create index i_username
  180. on xxl_job_user (username);
  181. create function upd_timestamp() returns trigger
  182. language plpgsql
  183. as
  184. $$
  185. begin
  186. new.update_time = current_timestamp;
  187. return new;
  188. end
  189. $$;
  190. alter function upd_timestamp() owner to postgres;