snail_job_postgre.sql 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  1. /*
  2. SnailJob Database Transfer Tool
  3. Source Server Type : MySQL
  4. Target Server Type : PostgreSQL
  5. Date: 2024-05-13 22:49:34
  6. */
  7. -- sj_namespace
  8. CREATE TABLE sj_namespace
  9. (
  10. id bigserial PRIMARY KEY,
  11. name varchar(64) NOT NULL,
  12. unique_id varchar(64) NOT NULL,
  13. description varchar(256) NOT NULL DEFAULT '',
  14. deleted smallint NOT NULL DEFAULT 0,
  15. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  16. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  17. );
  18. CREATE INDEX idx_sj_namespace_01 ON sj_namespace (name);
  19. COMMENT ON COLUMN sj_namespace.id IS '主键';
  20. COMMENT ON COLUMN sj_namespace.name IS '名称';
  21. COMMENT ON COLUMN sj_namespace.unique_id IS '唯一id';
  22. COMMENT ON COLUMN sj_namespace.description IS '描述';
  23. COMMENT ON COLUMN sj_namespace.deleted IS '逻辑删除 1、删除';
  24. COMMENT ON COLUMN sj_namespace.create_dt IS '创建时间';
  25. COMMENT ON COLUMN sj_namespace.update_dt IS '修改时间';
  26. COMMENT ON TABLE sj_namespace IS '命名空间';
  27. INSERT INTO sj_namespace VALUES (1, 'Development', 'dev', '', 0, now(), now());
  28. INSERT INTO sj_namespace VALUES (2, 'Production', 'prod', '', 0, now(), now());
  29. -- sj_group_config
  30. CREATE TABLE sj_group_config
  31. (
  32. id bigserial PRIMARY KEY,
  33. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  34. group_name varchar(64) NOT NULL DEFAULT '',
  35. description varchar(256) NOT NULL DEFAULT '',
  36. token varchar(64) NOT NULL DEFAULT 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT',
  37. group_status smallint NOT NULL DEFAULT 0,
  38. version int NOT NULL,
  39. group_partition int NOT NULL,
  40. id_generator_mode smallint NOT NULL DEFAULT 1,
  41. init_scene smallint NOT NULL DEFAULT 0,
  42. bucket_index int NOT NULL DEFAULT 0,
  43. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  44. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  45. );
  46. CREATE UNIQUE INDEX uk_sj_group_config_01 ON sj_group_config (namespace_id, group_name);
  47. COMMENT ON COLUMN sj_group_config.id IS '主键';
  48. COMMENT ON COLUMN sj_group_config.namespace_id IS '命名空间id';
  49. COMMENT ON COLUMN sj_group_config.group_name IS '组名称';
  50. COMMENT ON COLUMN sj_group_config.description IS '组描述';
  51. COMMENT ON COLUMN sj_group_config.token IS 'token';
  52. COMMENT ON COLUMN sj_group_config.group_status IS '组状态 0、未启用 1、启用';
  53. COMMENT ON COLUMN sj_group_config.version IS '版本号';
  54. COMMENT ON COLUMN sj_group_config.group_partition IS '分区';
  55. COMMENT ON COLUMN sj_group_config.id_generator_mode IS '唯一id生成模式 默认号段模式';
  56. COMMENT ON COLUMN sj_group_config.init_scene IS '是否初始化场景 0:否 1:是';
  57. COMMENT ON COLUMN sj_group_config.bucket_index IS 'bucket';
  58. COMMENT ON COLUMN sj_group_config.create_dt IS '创建时间';
  59. COMMENT ON COLUMN sj_group_config.update_dt IS '修改时间';
  60. COMMENT ON TABLE sj_group_config IS '组配置';
  61. INSERT INTO sj_group_config VALUES (1, 'dev', 'ruoyi_group', '', 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', 1, 1, 0, 1, 1, 4, now(), now());
  62. -- sj_notify_config
  63. CREATE TABLE sj_notify_config
  64. (
  65. id bigserial PRIMARY KEY,
  66. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  67. group_name varchar(64) NOT NULL,
  68. business_id varchar(64) NOT NULL,
  69. system_task_type smallint NOT NULL DEFAULT 3,
  70. notify_status smallint NOT NULL DEFAULT 0,
  71. recipient_ids varchar(128) NOT NULL,
  72. notify_threshold int NOT NULL DEFAULT 0,
  73. notify_scene smallint NOT NULL DEFAULT 0,
  74. rate_limiter_status smallint NOT NULL DEFAULT 0,
  75. rate_limiter_threshold int NOT NULL DEFAULT 0,
  76. description varchar(256) NOT NULL DEFAULT '',
  77. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  78. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  79. );
  80. CREATE INDEX idx_sj_notify_config_01 ON sj_notify_config (namespace_id, group_name, business_id);
  81. COMMENT ON COLUMN sj_notify_config.id IS '主键';
  82. COMMENT ON COLUMN sj_notify_config.namespace_id IS '命名空间id';
  83. COMMENT ON COLUMN sj_notify_config.group_name IS '组名称';
  84. COMMENT ON COLUMN sj_notify_config.business_id IS '业务id ( job_id或workflow_id或scene_name ) ';
  85. COMMENT ON COLUMN sj_notify_config.system_task_type IS '任务类型 1. 重试任务 2. 重试回调 3、JOB任务 4、WORKFLOW任务';
  86. COMMENT ON COLUMN sj_notify_config.notify_status IS '通知状态 0、未启用 1、启用';
  87. COMMENT ON COLUMN sj_notify_config.recipient_ids IS '接收人id列表';
  88. COMMENT ON COLUMN sj_notify_config.notify_threshold IS '通知阈值';
  89. COMMENT ON COLUMN sj_notify_config.notify_scene IS '通知场景';
  90. COMMENT ON COLUMN sj_notify_config.rate_limiter_status IS '限流状态 0、未启用 1、启用';
  91. COMMENT ON COLUMN sj_notify_config.rate_limiter_threshold IS '每秒限流阈值';
  92. COMMENT ON COLUMN sj_notify_config.description IS '描述';
  93. COMMENT ON COLUMN sj_notify_config.create_dt IS '创建时间';
  94. COMMENT ON COLUMN sj_notify_config.update_dt IS '修改时间';
  95. COMMENT ON TABLE sj_notify_config IS '通知配置';
  96. -- sj_notify_recipient
  97. CREATE TABLE sj_notify_recipient
  98. (
  99. id bigserial PRIMARY KEY,
  100. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  101. recipient_name varchar(64) NOT NULL,
  102. notify_type smallint NOT NULL DEFAULT 0,
  103. notify_attribute varchar(512) NOT NULL,
  104. description varchar(256) NOT NULL DEFAULT '',
  105. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  106. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  107. );
  108. CREATE INDEX idx_sj_notify_recipient_01 ON sj_notify_recipient (namespace_id);
  109. COMMENT ON COLUMN sj_notify_recipient.id IS '主键';
  110. COMMENT ON COLUMN sj_notify_recipient.namespace_id IS '命名空间id';
  111. COMMENT ON COLUMN sj_notify_recipient.recipient_name IS '接收人名称';
  112. COMMENT ON COLUMN sj_notify_recipient.notify_type IS '通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书';
  113. COMMENT ON COLUMN sj_notify_recipient.notify_attribute IS '配置属性';
  114. COMMENT ON COLUMN sj_notify_recipient.description IS '描述';
  115. COMMENT ON COLUMN sj_notify_recipient.create_dt IS '创建时间';
  116. COMMENT ON COLUMN sj_notify_recipient.update_dt IS '修改时间';
  117. COMMENT ON TABLE sj_notify_recipient IS '告警通知接收人';
  118. -- sj_retry_dead_letter_0
  119. CREATE TABLE sj_retry_dead_letter_0
  120. (
  121. id bigserial PRIMARY KEY,
  122. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  123. unique_id varchar(64) NOT NULL,
  124. group_name varchar(64) NOT NULL,
  125. scene_name varchar(64) NOT NULL,
  126. idempotent_id varchar(64) NOT NULL,
  127. biz_no varchar(64) NOT NULL DEFAULT '',
  128. executor_name varchar(512) NOT NULL DEFAULT '',
  129. args_str text NOT NULL,
  130. ext_attrs text NOT NULL,
  131. task_type smallint NOT NULL DEFAULT 1,
  132. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  133. );
  134. CREATE UNIQUE INDEX uk_sj_retry_dead_letter_0_01 ON sj_retry_dead_letter_0 (namespace_id, group_name, unique_id);
  135. CREATE INDEX idx_sj_retry_dead_letter_0_01 ON sj_retry_dead_letter_0 (namespace_id, group_name, scene_name);
  136. CREATE INDEX idx_sj_retry_dead_letter_0_02 ON sj_retry_dead_letter_0 (idempotent_id);
  137. CREATE INDEX idx_sj_retry_dead_letter_0_03 ON sj_retry_dead_letter_0 (biz_no);
  138. CREATE INDEX idx_sj_retry_dead_letter_0_04 ON sj_retry_dead_letter_0 (create_dt);
  139. COMMENT ON COLUMN sj_retry_dead_letter_0.id IS '主键';
  140. COMMENT ON COLUMN sj_retry_dead_letter_0.namespace_id IS '命名空间id';
  141. COMMENT ON COLUMN sj_retry_dead_letter_0.unique_id IS '同组下id唯一';
  142. COMMENT ON COLUMN sj_retry_dead_letter_0.group_name IS '组名称';
  143. COMMENT ON COLUMN sj_retry_dead_letter_0.scene_name IS '场景名称';
  144. COMMENT ON COLUMN sj_retry_dead_letter_0.idempotent_id IS '幂等id';
  145. COMMENT ON COLUMN sj_retry_dead_letter_0.biz_no IS '业务编号';
  146. COMMENT ON COLUMN sj_retry_dead_letter_0.executor_name IS '执行器名称';
  147. COMMENT ON COLUMN sj_retry_dead_letter_0.args_str IS '执行方法参数';
  148. COMMENT ON COLUMN sj_retry_dead_letter_0.ext_attrs IS '扩展字段';
  149. COMMENT ON COLUMN sj_retry_dead_letter_0.task_type IS '任务类型 1、重试数据 2、回调数据';
  150. COMMENT ON COLUMN sj_retry_dead_letter_0.create_dt IS '创建时间';
  151. COMMENT ON TABLE sj_retry_dead_letter_0 IS '死信队列表';
  152. -- sj_retry_task_0
  153. CREATE TABLE sj_retry_task_0
  154. (
  155. id bigserial PRIMARY KEY,
  156. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  157. unique_id varchar(64) NOT NULL,
  158. group_name varchar(64) NOT NULL,
  159. scene_name varchar(64) NOT NULL,
  160. idempotent_id varchar(64) NOT NULL,
  161. biz_no varchar(64) NOT NULL DEFAULT '',
  162. executor_name varchar(512) NOT NULL DEFAULT '',
  163. args_str text NOT NULL,
  164. ext_attrs text NOT NULL,
  165. next_trigger_at timestamp NOT NULL,
  166. retry_count int NOT NULL DEFAULT 0,
  167. retry_status smallint NOT NULL DEFAULT 0,
  168. task_type smallint NOT NULL DEFAULT 1,
  169. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  170. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  171. );
  172. CREATE UNIQUE INDEX uk_sj_retry_task_0_01 ON sj_retry_task_0 (namespace_id, group_name, unique_id);
  173. CREATE INDEX idx_sj_retry_task_0_01 ON sj_retry_task_0 (namespace_id, group_name, scene_name);
  174. CREATE INDEX idx_sj_retry_task_0_02 ON sj_retry_task_0 (namespace_id, group_name, task_type);
  175. CREATE INDEX idx_sj_retry_task_0_03 ON sj_retry_task_0 (namespace_id, group_name, retry_status);
  176. CREATE INDEX idx_sj_retry_task_0_04 ON sj_retry_task_0 (idempotent_id);
  177. CREATE INDEX idx_sj_retry_task_0_05 ON sj_retry_task_0 (biz_no);
  178. CREATE INDEX idx_sj_retry_task_0_06 ON sj_retry_task_0 (create_dt);
  179. COMMENT ON COLUMN sj_retry_task_0.id IS '主键';
  180. COMMENT ON COLUMN sj_retry_task_0.namespace_id IS '命名空间id';
  181. COMMENT ON COLUMN sj_retry_task_0.unique_id IS '同组下id唯一';
  182. COMMENT ON COLUMN sj_retry_task_0.group_name IS '组名称';
  183. COMMENT ON COLUMN sj_retry_task_0.scene_name IS '场景名称';
  184. COMMENT ON COLUMN sj_retry_task_0.idempotent_id IS '幂等id';
  185. COMMENT ON COLUMN sj_retry_task_0.biz_no IS '业务编号';
  186. COMMENT ON COLUMN sj_retry_task_0.executor_name IS '执行器名称';
  187. COMMENT ON COLUMN sj_retry_task_0.args_str IS '执行方法参数';
  188. COMMENT ON COLUMN sj_retry_task_0.ext_attrs IS '扩展字段';
  189. COMMENT ON COLUMN sj_retry_task_0.next_trigger_at IS '下次触发时间';
  190. COMMENT ON COLUMN sj_retry_task_0.retry_count IS '重试次数';
  191. COMMENT ON COLUMN sj_retry_task_0.retry_status IS '重试状态 0、重试中 1、成功 2、最大重试次数';
  192. COMMENT ON COLUMN sj_retry_task_0.task_type IS '任务类型 1、重试数据 2、回调数据';
  193. COMMENT ON COLUMN sj_retry_task_0.create_dt IS '创建时间';
  194. COMMENT ON COLUMN sj_retry_task_0.update_dt IS '修改时间';
  195. COMMENT ON TABLE sj_retry_task_0 IS '任务表';
  196. -- sj_retry_task_log
  197. CREATE TABLE sj_retry_task_log
  198. (
  199. id bigserial PRIMARY KEY,
  200. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  201. unique_id varchar(64) NOT NULL,
  202. group_name varchar(64) NOT NULL,
  203. scene_name varchar(64) NOT NULL,
  204. idempotent_id varchar(64) NOT NULL,
  205. biz_no varchar(64) NOT NULL DEFAULT '',
  206. executor_name varchar(512) NOT NULL DEFAULT '',
  207. args_str text NOT NULL,
  208. ext_attrs text NOT NULL,
  209. retry_status smallint NOT NULL DEFAULT 0,
  210. task_type smallint NOT NULL DEFAULT 1,
  211. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  212. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  213. );
  214. CREATE INDEX idx_sj_retry_task_log_01 ON sj_retry_task_log (namespace_id, group_name, scene_name);
  215. CREATE INDEX idx_sj_retry_task_log_02 ON sj_retry_task_log (retry_status);
  216. CREATE INDEX idx_sj_retry_task_log_03 ON sj_retry_task_log (idempotent_id);
  217. CREATE INDEX idx_sj_retry_task_log_04 ON sj_retry_task_log (unique_id);
  218. CREATE INDEX idx_sj_retry_task_log_05 ON sj_retry_task_log (biz_no);
  219. CREATE INDEX idx_sj_retry_task_log_06 ON sj_retry_task_log (create_dt);
  220. COMMENT ON COLUMN sj_retry_task_log.id IS '主键';
  221. COMMENT ON COLUMN sj_retry_task_log.namespace_id IS '命名空间id';
  222. COMMENT ON COLUMN sj_retry_task_log.unique_id IS '同组下id唯一';
  223. COMMENT ON COLUMN sj_retry_task_log.group_name IS '组名称';
  224. COMMENT ON COLUMN sj_retry_task_log.scene_name IS '场景名称';
  225. COMMENT ON COLUMN sj_retry_task_log.idempotent_id IS '幂等id';
  226. COMMENT ON COLUMN sj_retry_task_log.biz_no IS '业务编号';
  227. COMMENT ON COLUMN sj_retry_task_log.executor_name IS '执行器名称';
  228. COMMENT ON COLUMN sj_retry_task_log.args_str IS '执行方法参数';
  229. COMMENT ON COLUMN sj_retry_task_log.ext_attrs IS '扩展字段';
  230. COMMENT ON COLUMN sj_retry_task_log.retry_status IS '重试状态 0、重试中 1、成功 2、最大次数';
  231. COMMENT ON COLUMN sj_retry_task_log.task_type IS '任务类型 1、重试数据 2、回调数据';
  232. COMMENT ON COLUMN sj_retry_task_log.create_dt IS '创建时间';
  233. COMMENT ON COLUMN sj_retry_task_log.update_dt IS '修改时间';
  234. COMMENT ON TABLE sj_retry_task_log IS '任务日志基础信息表';
  235. -- sj_retry_task_log_message
  236. CREATE TABLE sj_retry_task_log_message
  237. (
  238. id bigserial PRIMARY KEY,
  239. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  240. group_name varchar(64) NOT NULL,
  241. unique_id varchar(64) NOT NULL,
  242. message text NOT NULL,
  243. log_num int NOT NULL DEFAULT 1,
  244. real_time bigint NOT NULL DEFAULT 0,
  245. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  246. );
  247. CREATE INDEX idx_sj_retry_task_log_message_01 ON sj_retry_task_log_message (namespace_id, group_name, unique_id);
  248. CREATE INDEX idx_sj_retry_task_log_message_02 ON sj_retry_task_log_message (create_dt);
  249. COMMENT ON COLUMN sj_retry_task_log_message.id IS '主键';
  250. COMMENT ON COLUMN sj_retry_task_log_message.namespace_id IS '命名空间id';
  251. COMMENT ON COLUMN sj_retry_task_log_message.group_name IS '组名称';
  252. COMMENT ON COLUMN sj_retry_task_log_message.unique_id IS '同组下id唯一';
  253. COMMENT ON COLUMN sj_retry_task_log_message.message IS '异常信息';
  254. COMMENT ON COLUMN sj_retry_task_log_message.log_num IS '日志数量';
  255. COMMENT ON COLUMN sj_retry_task_log_message.real_time IS '上报时间';
  256. COMMENT ON COLUMN sj_retry_task_log_message.create_dt IS '创建时间';
  257. COMMENT ON TABLE sj_retry_task_log_message IS '任务调度日志信息记录表';
  258. -- sj_retry_scene_config
  259. CREATE TABLE sj_retry_scene_config
  260. (
  261. id bigserial PRIMARY KEY,
  262. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  263. scene_name varchar(64) NOT NULL,
  264. group_name varchar(64) NOT NULL,
  265. scene_status smallint NOT NULL DEFAULT 0,
  266. max_retry_count int NOT NULL DEFAULT 5,
  267. back_off smallint NOT NULL DEFAULT 1,
  268. trigger_interval varchar(16) NOT NULL DEFAULT '',
  269. deadline_request bigint NOT NULL DEFAULT 60000,
  270. executor_timeout int NOT NULL DEFAULT 5,
  271. route_key smallint NOT NULL DEFAULT 4,
  272. description varchar(256) NOT NULL DEFAULT '',
  273. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  274. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  275. );
  276. CREATE UNIQUE INDEX uk_sj_retry_scene_config_01 ON sj_retry_scene_config (namespace_id, group_name, scene_name);
  277. COMMENT ON COLUMN sj_retry_scene_config.id IS '主键';
  278. COMMENT ON COLUMN sj_retry_scene_config.namespace_id IS '命名空间id';
  279. COMMENT ON COLUMN sj_retry_scene_config.scene_name IS '场景名称';
  280. COMMENT ON COLUMN sj_retry_scene_config.group_name IS '组名称';
  281. COMMENT ON COLUMN sj_retry_scene_config.scene_status IS '组状态 0、未启用 1、启用';
  282. COMMENT ON COLUMN sj_retry_scene_config.max_retry_count IS '最大重试次数';
  283. COMMENT ON COLUMN sj_retry_scene_config.back_off IS '1、默认等级 2、固定间隔时间 3、CRON 表达式';
  284. COMMENT ON COLUMN sj_retry_scene_config.trigger_interval IS '间隔时长';
  285. COMMENT ON COLUMN sj_retry_scene_config.deadline_request IS 'Deadline Request 调用链超时 单位毫秒';
  286. COMMENT ON COLUMN sj_retry_scene_config.executor_timeout IS '任务执行超时时间,单位秒';
  287. COMMENT ON COLUMN sj_retry_scene_config.route_key IS '路由策略';
  288. COMMENT ON COLUMN sj_retry_scene_config.description IS '描述';
  289. COMMENT ON COLUMN sj_retry_scene_config.create_dt IS '创建时间';
  290. COMMENT ON COLUMN sj_retry_scene_config.update_dt IS '修改时间';
  291. COMMENT ON TABLE sj_retry_scene_config IS '场景配置';
  292. -- sj_server_node
  293. CREATE TABLE sj_server_node
  294. (
  295. id bigserial PRIMARY KEY,
  296. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  297. group_name varchar(64) NOT NULL,
  298. host_id varchar(64) NOT NULL,
  299. host_ip varchar(64) NOT NULL,
  300. host_port int NOT NULL,
  301. expire_at timestamp NOT NULL,
  302. node_type smallint NOT NULL,
  303. ext_attrs varchar(256) NULL DEFAULT '',
  304. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  305. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  306. );
  307. CREATE UNIQUE INDEX uk_sj_server_node_01 ON sj_server_node (host_id, host_ip);
  308. CREATE INDEX idx_sj_server_node_01 ON sj_server_node (namespace_id, group_name);
  309. CREATE INDEX idx_sj_server_node_02 ON sj_server_node (expire_at, node_type);
  310. COMMENT ON COLUMN sj_server_node.id IS '主键';
  311. COMMENT ON COLUMN sj_server_node.namespace_id IS '命名空间id';
  312. COMMENT ON COLUMN sj_server_node.group_name IS '组名称';
  313. COMMENT ON COLUMN sj_server_node.host_id IS '主机id';
  314. COMMENT ON COLUMN sj_server_node.host_ip IS '机器ip';
  315. COMMENT ON COLUMN sj_server_node.host_port IS '机器端口';
  316. COMMENT ON COLUMN sj_server_node.expire_at IS '过期时间';
  317. COMMENT ON COLUMN sj_server_node.node_type IS '节点类型 1、客户端 2、是服务端';
  318. COMMENT ON COLUMN sj_server_node.ext_attrs IS '扩展字段';
  319. COMMENT ON COLUMN sj_server_node.create_dt IS '创建时间';
  320. COMMENT ON COLUMN sj_server_node.update_dt IS '修改时间';
  321. COMMENT ON TABLE sj_server_node IS '服务器节点';
  322. -- sj_distributed_lock
  323. CREATE TABLE sj_distributed_lock
  324. (
  325. id bigserial PRIMARY KEY,
  326. name varchar(64) NOT NULL,
  327. lock_until timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
  328. locked_at timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
  329. locked_by varchar(255) NOT NULL,
  330. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  331. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  332. );
  333. COMMENT ON COLUMN sj_distributed_lock.id IS '主键';
  334. COMMENT ON COLUMN sj_distributed_lock.name IS '锁名称';
  335. COMMENT ON COLUMN sj_distributed_lock.lock_until IS '锁定时长';
  336. COMMENT ON COLUMN sj_distributed_lock.locked_at IS '锁定时间';
  337. COMMENT ON COLUMN sj_distributed_lock.locked_by IS '锁定者';
  338. COMMENT ON COLUMN sj_distributed_lock.create_dt IS '创建时间';
  339. COMMENT ON COLUMN sj_distributed_lock.update_dt IS '修改时间';
  340. COMMENT ON TABLE sj_distributed_lock IS '锁定表';
  341. -- sj_system_user
  342. CREATE TABLE sj_system_user
  343. (
  344. id bigserial PRIMARY KEY,
  345. username varchar(64) NOT NULL,
  346. password varchar(128) NOT NULL,
  347. role smallint NOT NULL DEFAULT 0,
  348. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  349. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  350. );
  351. COMMENT ON COLUMN sj_system_user.id IS '主键';
  352. COMMENT ON COLUMN sj_system_user.username IS '账号';
  353. COMMENT ON COLUMN sj_system_user.password IS '密码';
  354. COMMENT ON COLUMN sj_system_user.role IS '角色:1-普通用户、2-管理员';
  355. COMMENT ON COLUMN sj_system_user.create_dt IS '创建时间';
  356. COMMENT ON COLUMN sj_system_user.update_dt IS '修改时间';
  357. COMMENT ON TABLE sj_system_user IS '系统用户表';
  358. -- pwd: admin
  359. INSERT INTO sj_system_user VALUES (1, 'admin', '465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac', 2, now(), now());
  360. -- sj_system_user_permission
  361. CREATE TABLE sj_system_user_permission
  362. (
  363. id bigserial PRIMARY KEY,
  364. group_name varchar(64) NOT NULL,
  365. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  366. system_user_id bigint NOT NULL,
  367. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  368. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  369. );
  370. CREATE UNIQUE INDEX uk_sj_system_user_permission_01 ON sj_system_user_permission (namespace_id, group_name, system_user_id);
  371. COMMENT ON COLUMN sj_system_user_permission.id IS '主键';
  372. COMMENT ON COLUMN sj_system_user_permission.group_name IS '组名称';
  373. COMMENT ON COLUMN sj_system_user_permission.namespace_id IS '命名空间id';
  374. COMMENT ON COLUMN sj_system_user_permission.system_user_id IS '系统用户id';
  375. COMMENT ON COLUMN sj_system_user_permission.create_dt IS '创建时间';
  376. COMMENT ON COLUMN sj_system_user_permission.update_dt IS '修改时间';
  377. COMMENT ON TABLE sj_system_user_permission IS '系统用户权限表';
  378. -- sj_sequence_alloc
  379. CREATE TABLE sj_sequence_alloc
  380. (
  381. id bigserial PRIMARY KEY,
  382. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  383. group_name varchar(64) NOT NULL DEFAULT '',
  384. max_id bigint NOT NULL DEFAULT 1,
  385. step int NOT NULL DEFAULT 100,
  386. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  387. );
  388. CREATE UNIQUE INDEX uk_sj_sequence_alloc_01 ON sj_sequence_alloc (namespace_id, group_name);
  389. COMMENT ON COLUMN sj_sequence_alloc.id IS '主键';
  390. COMMENT ON COLUMN sj_sequence_alloc.namespace_id IS '命名空间id';
  391. COMMENT ON COLUMN sj_sequence_alloc.group_name IS '组名称';
  392. COMMENT ON COLUMN sj_sequence_alloc.max_id IS '最大id';
  393. COMMENT ON COLUMN sj_sequence_alloc.step IS '步长';
  394. COMMENT ON COLUMN sj_sequence_alloc.update_dt IS '更新时间';
  395. COMMENT ON TABLE sj_sequence_alloc IS '号段模式序号ID分配表';
  396. -- sj_job
  397. CREATE TABLE sj_job
  398. (
  399. id bigserial PRIMARY KEY,
  400. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  401. group_name varchar(64) NOT NULL,
  402. job_name varchar(64) NOT NULL,
  403. args_str text NULL DEFAULT NULL,
  404. args_type smallint NOT NULL DEFAULT 1,
  405. next_trigger_at bigint NOT NULL,
  406. job_status smallint NOT NULL DEFAULT 1,
  407. task_type smallint NOT NULL DEFAULT 1,
  408. route_key smallint NOT NULL DEFAULT 4,
  409. executor_type smallint NOT NULL DEFAULT 1,
  410. executor_info varchar(255) NULL DEFAULT NULL,
  411. trigger_type smallint NOT NULL,
  412. trigger_interval varchar(255) NOT NULL,
  413. block_strategy smallint NOT NULL DEFAULT 1,
  414. executor_timeout int NOT NULL DEFAULT 0,
  415. max_retry_times int NOT NULL DEFAULT 0,
  416. parallel_num int NOT NULL DEFAULT 1,
  417. retry_interval int NOT NULL DEFAULT 0,
  418. bucket_index int NOT NULL DEFAULT 0,
  419. resident smallint NOT NULL DEFAULT 0,
  420. description varchar(256) NOT NULL DEFAULT '',
  421. ext_attrs varchar(256) NULL DEFAULT '',
  422. deleted smallint NOT NULL DEFAULT 0,
  423. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  424. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  425. );
  426. CREATE INDEX idx_sj_job_01 ON sj_job (namespace_id, group_name);
  427. CREATE INDEX idx_sj_job_02 ON sj_job (job_status, bucket_index);
  428. CREATE INDEX idx_sj_job_03 ON sj_job (create_dt);
  429. COMMENT ON COLUMN sj_job.id IS '主键';
  430. COMMENT ON COLUMN sj_job.namespace_id IS '命名空间id';
  431. COMMENT ON COLUMN sj_job.group_name IS '组名称';
  432. COMMENT ON COLUMN sj_job.job_name IS '名称';
  433. COMMENT ON COLUMN sj_job.args_str IS '执行方法参数';
  434. COMMENT ON COLUMN sj_job.args_type IS '参数类型 ';
  435. COMMENT ON COLUMN sj_job.next_trigger_at IS '下次触发时间';
  436. COMMENT ON COLUMN sj_job.job_status IS '任务状态 0、关闭、1、开启';
  437. COMMENT ON COLUMN sj_job.task_type IS '任务类型 1、集群 2、广播 3、切片';
  438. COMMENT ON COLUMN sj_job.route_key IS '路由策略';
  439. COMMENT ON COLUMN sj_job.executor_type IS '执行器类型';
  440. COMMENT ON COLUMN sj_job.executor_info IS '执行器名称';
  441. COMMENT ON COLUMN sj_job.trigger_type IS '触发类型 1.CRON 表达式 2. 固定时间';
  442. COMMENT ON COLUMN sj_job.trigger_interval IS '间隔时长';
  443. COMMENT ON COLUMN sj_job.block_strategy IS '阻塞策略 1、丢弃 2、覆盖 3、并行';
  444. COMMENT ON COLUMN sj_job.executor_timeout IS '任务执行超时时间,单位秒';
  445. COMMENT ON COLUMN sj_job.max_retry_times IS '最大重试次数';
  446. COMMENT ON COLUMN sj_job.parallel_num IS '并行数';
  447. COMMENT ON COLUMN sj_job.retry_interval IS '重试间隔 ( s ) ';
  448. COMMENT ON COLUMN sj_job.bucket_index IS 'bucket';
  449. COMMENT ON COLUMN sj_job.resident IS '是否是常驻任务';
  450. COMMENT ON COLUMN sj_job.description IS '描述';
  451. COMMENT ON COLUMN sj_job.ext_attrs IS '扩展字段';
  452. COMMENT ON COLUMN sj_job.deleted IS '逻辑删除 1、删除';
  453. COMMENT ON COLUMN sj_job.create_dt IS '创建时间';
  454. COMMENT ON COLUMN sj_job.update_dt IS '修改时间';
  455. COMMENT ON TABLE sj_job IS '任务信息';
  456. INSERT INTO sj_job VALUES (1, 'dev', 'ruoyi_group', 'demo-job', null, 1, 1710344035622, 1, 1, 4, 1, 'testJobExecutor', 2, '60', 1, 60, 3, 1, 1, 116, 0, '', '', 0, now(), now());
  457. -- sj_job_log_message
  458. CREATE TABLE sj_job_log_message
  459. (
  460. id bigserial PRIMARY KEY,
  461. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  462. group_name varchar(64) NOT NULL,
  463. job_id bigint NOT NULL,
  464. task_batch_id bigint NOT NULL,
  465. task_id bigint NOT NULL,
  466. message text NOT NULL,
  467. log_num int NOT NULL DEFAULT 1,
  468. real_time bigint NOT NULL DEFAULT 0,
  469. ext_attrs varchar(256) NULL DEFAULT '',
  470. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  471. );
  472. CREATE INDEX idx_sj_job_log_message_01 ON sj_job_log_message (task_batch_id, task_id);
  473. CREATE INDEX idx_sj_job_log_message_02 ON sj_job_log_message (create_dt);
  474. CREATE INDEX idx_sj_job_log_message_03 ON sj_job_log_message (namespace_id, group_name);
  475. COMMENT ON COLUMN sj_job_log_message.id IS '主键';
  476. COMMENT ON COLUMN sj_job_log_message.namespace_id IS '命名空间id';
  477. COMMENT ON COLUMN sj_job_log_message.group_name IS '组名称';
  478. COMMENT ON COLUMN sj_job_log_message.job_id IS '任务信息id';
  479. COMMENT ON COLUMN sj_job_log_message.task_batch_id IS '任务批次id';
  480. COMMENT ON COLUMN sj_job_log_message.task_id IS '调度任务id';
  481. COMMENT ON COLUMN sj_job_log_message.message IS '调度信息';
  482. COMMENT ON COLUMN sj_job_log_message.log_num IS '日志数量';
  483. COMMENT ON COLUMN sj_job_log_message.real_time IS '上报时间';
  484. COMMENT ON COLUMN sj_job_log_message.ext_attrs IS '扩展字段';
  485. COMMENT ON COLUMN sj_job_log_message.create_dt IS '创建时间';
  486. COMMENT ON TABLE sj_job_log_message IS '调度日志';
  487. -- sj_job_task
  488. CREATE TABLE sj_job_task
  489. (
  490. id bigserial PRIMARY KEY,
  491. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  492. group_name varchar(64) NOT NULL,
  493. job_id bigint NOT NULL,
  494. task_batch_id bigint NOT NULL,
  495. parent_id bigint NOT NULL DEFAULT 0,
  496. task_status smallint NOT NULL DEFAULT 0,
  497. retry_count int NOT NULL DEFAULT 0,
  498. client_info varchar(128) NULL DEFAULT NULL,
  499. result_message text NOT NULL,
  500. args_str text NULL DEFAULT NULL,
  501. args_type smallint NOT NULL DEFAULT 1,
  502. ext_attrs varchar(256) NULL DEFAULT '',
  503. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  504. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  505. );
  506. CREATE INDEX idx_sj_job_task_01 ON sj_job_task (task_batch_id, task_status);
  507. CREATE INDEX idx_sj_job_task_02 ON sj_job_task (create_dt);
  508. CREATE INDEX idx_sj_job_task_03 ON sj_job_task (namespace_id, group_name);
  509. COMMENT ON COLUMN sj_job_task.id IS '主键';
  510. COMMENT ON COLUMN sj_job_task.namespace_id IS '命名空间id';
  511. COMMENT ON COLUMN sj_job_task.group_name IS '组名称';
  512. COMMENT ON COLUMN sj_job_task.job_id IS '任务信息id';
  513. COMMENT ON COLUMN sj_job_task.task_batch_id IS '调度任务id';
  514. COMMENT ON COLUMN sj_job_task.parent_id IS '父执行器id';
  515. COMMENT ON COLUMN sj_job_task.task_status IS '执行的状态 0、失败 1、成功';
  516. COMMENT ON COLUMN sj_job_task.retry_count IS '重试次数';
  517. COMMENT ON COLUMN sj_job_task.client_info IS '客户端地址 clientId#ip:port';
  518. COMMENT ON COLUMN sj_job_task.result_message IS '执行结果';
  519. COMMENT ON COLUMN sj_job_task.args_str IS '执行方法参数';
  520. COMMENT ON COLUMN sj_job_task.args_type IS '参数类型 ';
  521. COMMENT ON COLUMN sj_job_task.ext_attrs IS '扩展字段';
  522. COMMENT ON COLUMN sj_job_task.create_dt IS '创建时间';
  523. COMMENT ON COLUMN sj_job_task.update_dt IS '修改时间';
  524. COMMENT ON TABLE sj_job_task IS '任务实例';
  525. -- sj_job_task_batch
  526. CREATE TABLE sj_job_task_batch
  527. (
  528. id bigserial PRIMARY KEY,
  529. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  530. group_name varchar(64) NOT NULL,
  531. job_id bigint NOT NULL,
  532. workflow_node_id bigint NOT NULL DEFAULT 0,
  533. parent_workflow_node_id bigint NOT NULL DEFAULT 0,
  534. workflow_task_batch_id bigint NOT NULL DEFAULT 0,
  535. task_batch_status smallint NOT NULL DEFAULT 0,
  536. operation_reason smallint NOT NULL DEFAULT 0,
  537. execution_at bigint NOT NULL DEFAULT 0,
  538. system_task_type smallint NOT NULL DEFAULT 3,
  539. parent_id varchar(64) NOT NULL DEFAULT '',
  540. ext_attrs varchar(256) NULL DEFAULT '',
  541. deleted smallint NOT NULL DEFAULT 0,
  542. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  543. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  544. );
  545. CREATE INDEX idx_sj_job_task_batch_01 ON sj_job_task_batch (job_id, task_batch_status);
  546. CREATE INDEX idx_sj_job_task_batch_02 ON sj_job_task_batch (create_dt);
  547. CREATE INDEX idx_sj_job_task_batch_03 ON sj_job_task_batch (namespace_id, group_name);
  548. CREATE INDEX idx_sj_job_task_batch_04 ON sj_job_task_batch (workflow_task_batch_id, workflow_node_id);
  549. COMMENT ON COLUMN sj_job_task_batch.id IS '主键';
  550. COMMENT ON COLUMN sj_job_task_batch.namespace_id IS '命名空间id';
  551. COMMENT ON COLUMN sj_job_task_batch.group_name IS '组名称';
  552. COMMENT ON COLUMN sj_job_task_batch.job_id IS '任务id';
  553. COMMENT ON COLUMN sj_job_task_batch.workflow_node_id IS '工作流节点id';
  554. COMMENT ON COLUMN sj_job_task_batch.parent_workflow_node_id IS '工作流任务父批次id';
  555. COMMENT ON COLUMN sj_job_task_batch.workflow_task_batch_id IS '工作流任务批次id';
  556. COMMENT ON COLUMN sj_job_task_batch.task_batch_status IS '任务批次状态 0、失败 1、成功';
  557. COMMENT ON COLUMN sj_job_task_batch.operation_reason IS '操作原因';
  558. COMMENT ON COLUMN sj_job_task_batch.execution_at IS '任务执行时间';
  559. COMMENT ON COLUMN sj_job_task_batch.system_task_type IS '任务类型 3、JOB任务 4、WORKFLOW任务';
  560. COMMENT ON COLUMN sj_job_task_batch.parent_id IS '父节点';
  561. COMMENT ON COLUMN sj_job_task_batch.ext_attrs IS '扩展字段';
  562. COMMENT ON COLUMN sj_job_task_batch.deleted IS '逻辑删除 1、删除';
  563. COMMENT ON COLUMN sj_job_task_batch.create_dt IS '创建时间';
  564. COMMENT ON COLUMN sj_job_task_batch.update_dt IS '修改时间';
  565. COMMENT ON TABLE sj_job_task_batch IS '任务批次';
  566. -- sj_job_summary
  567. CREATE TABLE sj_job_summary
  568. (
  569. id bigserial PRIMARY KEY,
  570. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  571. group_name varchar(64) NOT NULL DEFAULT '',
  572. business_id bigint NOT NULL,
  573. system_task_type smallint NOT NULL DEFAULT 3,
  574. trigger_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  575. success_num int NOT NULL DEFAULT 0,
  576. fail_num int NOT NULL DEFAULT 0,
  577. fail_reason varchar(512) NOT NULL DEFAULT '',
  578. stop_num int NOT NULL DEFAULT 0,
  579. stop_reason varchar(512) NOT NULL DEFAULT '',
  580. cancel_num int NOT NULL DEFAULT 0,
  581. cancel_reason varchar(512) NOT NULL DEFAULT '',
  582. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  583. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  584. );
  585. CREATE UNIQUE INDEX uk_sj_job_summary_01 ON sj_job_summary (trigger_at, system_task_type, business_id);
  586. CREATE INDEX idx_sj_job_summary_01 ON sj_job_summary (namespace_id, group_name, business_id);
  587. COMMENT ON COLUMN sj_job_summary.id IS '主键';
  588. COMMENT ON COLUMN sj_job_summary.namespace_id IS '命名空间id';
  589. COMMENT ON COLUMN sj_job_summary.group_name IS '组名称';
  590. COMMENT ON COLUMN sj_job_summary.business_id IS '业务id ( job_id或workflow_id ) ';
  591. COMMENT ON COLUMN sj_job_summary.system_task_type IS '任务类型 3、JOB任务 4、WORKFLOW任务';
  592. COMMENT ON COLUMN sj_job_summary.trigger_at IS '统计时间';
  593. COMMENT ON COLUMN sj_job_summary.success_num IS '执行成功-日志数量';
  594. COMMENT ON COLUMN sj_job_summary.fail_num IS '执行失败-日志数量';
  595. COMMENT ON COLUMN sj_job_summary.fail_reason IS '失败原因';
  596. COMMENT ON COLUMN sj_job_summary.stop_num IS '执行失败-日志数量';
  597. COMMENT ON COLUMN sj_job_summary.stop_reason IS '失败原因';
  598. COMMENT ON COLUMN sj_job_summary.cancel_num IS '执行失败-日志数量';
  599. COMMENT ON COLUMN sj_job_summary.cancel_reason IS '失败原因';
  600. COMMENT ON COLUMN sj_job_summary.create_dt IS '创建时间';
  601. COMMENT ON COLUMN sj_job_summary.update_dt IS '修改时间';
  602. COMMENT ON TABLE sj_job_summary IS 'DashBoard_Job';
  603. -- sj_retry_summary
  604. CREATE TABLE sj_retry_summary
  605. (
  606. id bigserial PRIMARY KEY,
  607. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  608. group_name varchar(64) NOT NULL DEFAULT '',
  609. scene_name varchar(50) NOT NULL DEFAULT '',
  610. trigger_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  611. running_num int NOT NULL DEFAULT 0,
  612. finish_num int NOT NULL DEFAULT 0,
  613. max_count_num int NOT NULL DEFAULT 0,
  614. suspend_num int NOT NULL DEFAULT 0,
  615. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  616. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  617. );
  618. CREATE UNIQUE INDEX uk_sj_retry_summary_01 ON sj_retry_summary (namespace_id, group_name, scene_name, trigger_at);
  619. CREATE INDEX idx_sj_retry_summary_01 ON sj_retry_summary (trigger_at);
  620. COMMENT ON COLUMN sj_retry_summary.id IS '主键';
  621. COMMENT ON COLUMN sj_retry_summary.namespace_id IS '命名空间id';
  622. COMMENT ON COLUMN sj_retry_summary.group_name IS '组名称';
  623. COMMENT ON COLUMN sj_retry_summary.scene_name IS '场景名称';
  624. COMMENT ON COLUMN sj_retry_summary.trigger_at IS '统计时间';
  625. COMMENT ON COLUMN sj_retry_summary.running_num IS '重试中-日志数量';
  626. COMMENT ON COLUMN sj_retry_summary.finish_num IS '重试完成-日志数量';
  627. COMMENT ON COLUMN sj_retry_summary.max_count_num IS '重试到达最大次数-日志数量';
  628. COMMENT ON COLUMN sj_retry_summary.suspend_num IS '暂停重试-日志数量';
  629. COMMENT ON COLUMN sj_retry_summary.create_dt IS '创建时间';
  630. COMMENT ON COLUMN sj_retry_summary.update_dt IS '修改时间';
  631. COMMENT ON TABLE sj_retry_summary IS 'DashBoard_Retry';
  632. -- sj_workflow
  633. CREATE TABLE sj_workflow
  634. (
  635. id bigserial PRIMARY KEY,
  636. workflow_name varchar(64) NOT NULL,
  637. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  638. group_name varchar(64) NOT NULL,
  639. workflow_status smallint NOT NULL DEFAULT 1,
  640. trigger_type smallint NOT NULL,
  641. trigger_interval varchar(255) NOT NULL,
  642. next_trigger_at bigint NOT NULL,
  643. block_strategy smallint NOT NULL DEFAULT 1,
  644. executor_timeout int NOT NULL DEFAULT 0,
  645. description varchar(256) NOT NULL DEFAULT '',
  646. flow_info text NULL DEFAULT NULL,
  647. bucket_index int NOT NULL DEFAULT 0,
  648. version int NOT NULL,
  649. ext_attrs varchar(256) NULL DEFAULT '',
  650. deleted smallint NOT NULL DEFAULT 0,
  651. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  652. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  653. );
  654. CREATE INDEX idx_sj_workflow_01 ON sj_workflow (create_dt);
  655. CREATE INDEX idx_sj_workflow_02 ON sj_workflow (namespace_id, group_name);
  656. COMMENT ON COLUMN sj_workflow.id IS '主键';
  657. COMMENT ON COLUMN sj_workflow.workflow_name IS '工作流名称';
  658. COMMENT ON COLUMN sj_workflow.namespace_id IS '命名空间id';
  659. COMMENT ON COLUMN sj_workflow.group_name IS '组名称';
  660. COMMENT ON COLUMN sj_workflow.workflow_status IS '工作流状态 0、关闭、1、开启';
  661. COMMENT ON COLUMN sj_workflow.trigger_type IS '触发类型 1.CRON 表达式 2. 固定时间';
  662. COMMENT ON COLUMN sj_workflow.trigger_interval IS '间隔时长';
  663. COMMENT ON COLUMN sj_workflow.next_trigger_at IS '下次触发时间';
  664. COMMENT ON COLUMN sj_workflow.block_strategy IS '阻塞策略 1、丢弃 2、覆盖 3、并行';
  665. COMMENT ON COLUMN sj_workflow.executor_timeout IS '任务执行超时时间,单位秒';
  666. COMMENT ON COLUMN sj_workflow.description IS '描述';
  667. COMMENT ON COLUMN sj_workflow.flow_info IS '流程信息';
  668. COMMENT ON COLUMN sj_workflow.bucket_index IS 'bucket';
  669. COMMENT ON COLUMN sj_workflow.version IS '版本号';
  670. COMMENT ON COLUMN sj_workflow.ext_attrs IS '扩展字段';
  671. COMMENT ON COLUMN sj_workflow.deleted IS '逻辑删除 1、删除';
  672. COMMENT ON COLUMN sj_workflow.create_dt IS '创建时间';
  673. COMMENT ON COLUMN sj_workflow.update_dt IS '修改时间';
  674. COMMENT ON TABLE sj_workflow IS '工作流';
  675. -- sj_workflow_node
  676. CREATE TABLE sj_workflow_node
  677. (
  678. id bigserial PRIMARY KEY,
  679. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  680. node_name varchar(64) NOT NULL,
  681. group_name varchar(64) NOT NULL,
  682. job_id bigint NOT NULL,
  683. workflow_id bigint NOT NULL,
  684. node_type smallint NOT NULL DEFAULT 1,
  685. expression_type smallint NOT NULL DEFAULT 0,
  686. fail_strategy smallint NOT NULL DEFAULT 1,
  687. workflow_node_status smallint NOT NULL DEFAULT 1,
  688. priority_level int NOT NULL DEFAULT 1,
  689. node_info text NULL DEFAULT NULL,
  690. version int NOT NULL,
  691. ext_attrs varchar(256) NULL DEFAULT '',
  692. deleted smallint NOT NULL DEFAULT 0,
  693. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  694. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  695. );
  696. CREATE INDEX idx_sj_workflow_node_01 ON sj_workflow_node (create_dt);
  697. CREATE INDEX idx_sj_workflow_node_02 ON sj_workflow_node (namespace_id, group_name);
  698. COMMENT ON COLUMN sj_workflow_node.id IS '主键';
  699. COMMENT ON COLUMN sj_workflow_node.namespace_id IS '命名空间id';
  700. COMMENT ON COLUMN sj_workflow_node.node_name IS '节点名称';
  701. COMMENT ON COLUMN sj_workflow_node.group_name IS '组名称';
  702. COMMENT ON COLUMN sj_workflow_node.job_id IS '任务信息id';
  703. COMMENT ON COLUMN sj_workflow_node.workflow_id IS '工作流ID';
  704. COMMENT ON COLUMN sj_workflow_node.node_type IS '1、任务节点 2、条件节点';
  705. COMMENT ON COLUMN sj_workflow_node.expression_type IS '1、SpEl、2、Aviator 3、QL';
  706. COMMENT ON COLUMN sj_workflow_node.fail_strategy IS '失败策略 1、跳过 2、阻塞';
  707. COMMENT ON COLUMN sj_workflow_node.workflow_node_status IS '工作流节点状态 0、关闭、1、开启';
  708. COMMENT ON COLUMN sj_workflow_node.priority_level IS '优先级';
  709. COMMENT ON COLUMN sj_workflow_node.node_info IS '节点信息 ';
  710. COMMENT ON COLUMN sj_workflow_node.version IS '版本号';
  711. COMMENT ON COLUMN sj_workflow_node.ext_attrs IS '扩展字段';
  712. COMMENT ON COLUMN sj_workflow_node.deleted IS '逻辑删除 1、删除';
  713. COMMENT ON COLUMN sj_workflow_node.create_dt IS '创建时间';
  714. COMMENT ON COLUMN sj_workflow_node.update_dt IS '修改时间';
  715. COMMENT ON TABLE sj_workflow_node IS '工作流节点';
  716. -- sj_workflow_task_batch
  717. CREATE TABLE sj_workflow_task_batch
  718. (
  719. id bigserial PRIMARY KEY,
  720. namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  721. group_name varchar(64) NOT NULL,
  722. workflow_id bigint NOT NULL,
  723. task_batch_status smallint NOT NULL DEFAULT 0,
  724. operation_reason smallint NOT NULL DEFAULT 0,
  725. flow_info text NULL DEFAULT NULL,
  726. execution_at bigint NOT NULL DEFAULT 0,
  727. ext_attrs varchar(256) NULL DEFAULT '',
  728. deleted smallint NOT NULL DEFAULT 0,
  729. create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  730. update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  731. );
  732. CREATE INDEX idx_sj_workflow_task_batch_01 ON sj_workflow_task_batch (workflow_id, task_batch_status);
  733. CREATE INDEX idx_sj_workflow_task_batch_02 ON sj_workflow_task_batch (create_dt);
  734. CREATE INDEX idx_sj_workflow_task_batch_03 ON sj_workflow_task_batch (namespace_id, group_name);
  735. COMMENT ON COLUMN sj_workflow_task_batch.id IS '主键';
  736. COMMENT ON COLUMN sj_workflow_task_batch.namespace_id IS '命名空间id';
  737. COMMENT ON COLUMN sj_workflow_task_batch.group_name IS '组名称';
  738. COMMENT ON COLUMN sj_workflow_task_batch.workflow_id IS '工作流任务id';
  739. COMMENT ON COLUMN sj_workflow_task_batch.task_batch_status IS '任务批次状态 0、失败 1、成功';
  740. COMMENT ON COLUMN sj_workflow_task_batch.operation_reason IS '操作原因';
  741. COMMENT ON COLUMN sj_workflow_task_batch.flow_info IS '流程信息';
  742. COMMENT ON COLUMN sj_workflow_task_batch.execution_at IS '任务执行时间';
  743. COMMENT ON COLUMN sj_workflow_task_batch.ext_attrs IS '扩展字段';
  744. COMMENT ON COLUMN sj_workflow_task_batch.deleted IS '逻辑删除 1、删除';
  745. COMMENT ON COLUMN sj_workflow_task_batch.create_dt IS '创建时间';
  746. COMMENT ON COLUMN sj_workflow_task_batch.update_dt IS '修改时间';
  747. COMMENT ON TABLE sj_workflow_task_batch IS '工作流批次';