oracle_ry_job.sql 55 KB

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