snail_job_sqlserver.sql 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697
  1. /*
  2. SnailJob Database Transfer Tool
  3. Source Server Type : MySQL
  4. Target Server Type : Microsoft SQL Server
  5. Date: 2024-05-13 23:03:34
  6. */
  7. -- sj_namespace
  8. CREATE TABLE sj_namespace
  9. (
  10. id bigint NOT NULL PRIMARY KEY IDENTITY,
  11. name nvarchar(64) NOT NULL,
  12. unique_id nvarchar(64) NOT NULL,
  13. description nvarchar(256) NOT NULL DEFAULT '',
  14. deleted tinyint NOT NULL DEFAULT 0,
  15. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  16. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  17. )
  18. GO
  19. CREATE INDEX idx_sj_namespace_01 ON sj_namespace (name)
  20. GO
  21. EXEC sp_addextendedproperty
  22. 'MS_Description', N'主键',
  23. 'SCHEMA', N'dbo',
  24. 'TABLE', N'sj_namespace',
  25. 'COLUMN', N'id'
  26. GO
  27. EXEC sp_addextendedproperty
  28. 'MS_Description', N'名称',
  29. 'SCHEMA', N'dbo',
  30. 'TABLE', N'sj_namespace',
  31. 'COLUMN', N'name'
  32. GO
  33. EXEC sp_addextendedproperty
  34. 'MS_Description', N'唯一id',
  35. 'SCHEMA', N'dbo',
  36. 'TABLE', N'sj_namespace',
  37. 'COLUMN', N'unique_id'
  38. GO
  39. EXEC sp_addextendedproperty
  40. 'MS_Description', N'描述',
  41. 'SCHEMA', N'dbo',
  42. 'TABLE', N'sj_namespace',
  43. 'COLUMN', N'description'
  44. GO
  45. EXEC sp_addextendedproperty
  46. 'MS_Description', N'逻辑删除 1、删除',
  47. 'SCHEMA', N'dbo',
  48. 'TABLE', N'sj_namespace',
  49. 'COLUMN', N'deleted'
  50. GO
  51. EXEC sp_addextendedproperty
  52. 'MS_Description', N'创建时间',
  53. 'SCHEMA', N'dbo',
  54. 'TABLE', N'sj_namespace',
  55. 'COLUMN', N'create_dt'
  56. GO
  57. EXEC sp_addextendedproperty
  58. 'MS_Description', N'修改时间',
  59. 'SCHEMA', N'dbo',
  60. 'TABLE', N'sj_namespace',
  61. 'COLUMN', N'update_dt'
  62. GO
  63. EXEC sp_addextendedproperty
  64. 'MS_Description', N'命名空间',
  65. 'SCHEMA', N'dbo',
  66. 'TABLE', N'sj_namespace'
  67. GO
  68. INSERT INTO sj_namespace(name, unique_id, description, deleted, create_dt, update_dt) VALUES (N'Development', N'dev', N'', 0, getdate(), getdate())
  69. GO
  70. INSERT INTO sj_namespace(name, unique_id, description, deleted, create_dt, update_dt) VALUES (N'Production', N'prod', N'', 0, getdate(), getdate())
  71. GO
  72. -- sj_group_config
  73. CREATE TABLE sj_group_config
  74. (
  75. id bigint NOT NULL PRIMARY KEY IDENTITY,
  76. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  77. group_name nvarchar(64) NOT NULL DEFAULT '',
  78. description nvarchar(256) NOT NULL DEFAULT '',
  79. token nvarchar(64) NOT NULL DEFAULT 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT',
  80. group_status tinyint NOT NULL DEFAULT 0,
  81. version int NOT NULL,
  82. group_partition int NOT NULL,
  83. id_generator_mode tinyint NOT NULL DEFAULT 1,
  84. init_scene tinyint NOT NULL DEFAULT 0,
  85. bucket_index int NOT NULL DEFAULT 0,
  86. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  87. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  88. )
  89. GO
  90. CREATE UNIQUE INDEX uk_sj_group_config_01 ON sj_group_config (namespace_id, group_name)
  91. GO
  92. EXEC sp_addextendedproperty
  93. 'MS_Description', N'主键',
  94. 'SCHEMA', N'dbo',
  95. 'TABLE', N'sj_group_config',
  96. 'COLUMN', N'id'
  97. GO
  98. EXEC sp_addextendedproperty
  99. 'MS_Description', N'命名空间id',
  100. 'SCHEMA', N'dbo',
  101. 'TABLE', N'sj_group_config',
  102. 'COLUMN', N'namespace_id'
  103. GO
  104. EXEC sp_addextendedproperty
  105. 'MS_Description', N'组名称',
  106. 'SCHEMA', N'dbo',
  107. 'TABLE', N'sj_group_config',
  108. 'COLUMN', N'group_name'
  109. GO
  110. EXEC sp_addextendedproperty
  111. 'MS_Description', N'组描述',
  112. 'SCHEMA', N'dbo',
  113. 'TABLE', N'sj_group_config',
  114. 'COLUMN', N'description'
  115. GO
  116. EXEC sp_addextendedproperty
  117. 'MS_Description', N'token',
  118. 'SCHEMA', N'dbo',
  119. 'TABLE', N'sj_group_config',
  120. 'COLUMN', N'token'
  121. GO
  122. EXEC sp_addextendedproperty
  123. 'MS_Description', N'组状态 0、未启用 1、启用',
  124. 'SCHEMA', N'dbo',
  125. 'TABLE', N'sj_group_config',
  126. 'COLUMN', N'group_status'
  127. GO
  128. EXEC sp_addextendedproperty
  129. 'MS_Description', N'版本号',
  130. 'SCHEMA', N'dbo',
  131. 'TABLE', N'sj_group_config',
  132. 'COLUMN', N'version'
  133. GO
  134. EXEC sp_addextendedproperty
  135. 'MS_Description', N'分区',
  136. 'SCHEMA', N'dbo',
  137. 'TABLE', N'sj_group_config',
  138. 'COLUMN', N'group_partition'
  139. GO
  140. EXEC sp_addextendedproperty
  141. 'MS_Description', N'唯一id生成模式 默认号段模式',
  142. 'SCHEMA', N'dbo',
  143. 'TABLE', N'sj_group_config',
  144. 'COLUMN', N'id_generator_mode'
  145. GO
  146. EXEC sp_addextendedproperty
  147. 'MS_Description', N'是否初始化场景 0:否 1:是',
  148. 'SCHEMA', N'dbo',
  149. 'TABLE', N'sj_group_config',
  150. 'COLUMN', N'init_scene'
  151. GO
  152. EXEC sp_addextendedproperty
  153. 'MS_Description', N'bucket',
  154. 'SCHEMA', N'dbo',
  155. 'TABLE', N'sj_group_config',
  156. 'COLUMN', N'bucket_index'
  157. GO
  158. EXEC sp_addextendedproperty
  159. 'MS_Description', N'创建时间',
  160. 'SCHEMA', N'dbo',
  161. 'TABLE', N'sj_group_config',
  162. 'COLUMN', N'create_dt'
  163. GO
  164. EXEC sp_addextendedproperty
  165. 'MS_Description', N'修改时间',
  166. 'SCHEMA', N'dbo',
  167. 'TABLE', N'sj_group_config',
  168. 'COLUMN', N'update_dt'
  169. GO
  170. EXEC sp_addextendedproperty
  171. 'MS_Description', N'组配置',
  172. 'SCHEMA', N'dbo',
  173. 'TABLE', N'sj_group_config'
  174. GO
  175. INSERT INTO sj_group_config(namespace_id, group_name, description, token, group_status, version, group_partition, id_generator_mode, init_scene, bucket_index, create_dt, update_dt) VALUES (N'dev', N'ruoyi_group', N'', N'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', N'1', N'1', N'0', N'1', N'1', N'4', getdate(), getdate())
  176. GO
  177. -- sj_notify_config
  178. CREATE TABLE sj_notify_config
  179. (
  180. id bigint NOT NULL PRIMARY KEY IDENTITY,
  181. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  182. group_name nvarchar(64) NOT NULL,
  183. business_id nvarchar(64) NOT NULL,
  184. system_task_type tinyint NOT NULL DEFAULT 3,
  185. notify_status tinyint NOT NULL DEFAULT 0,
  186. recipient_ids nvarchar(128) NOT NULL,
  187. notify_threshold int NOT NULL DEFAULT 0,
  188. notify_scene tinyint NOT NULL DEFAULT 0,
  189. rate_limiter_status tinyint NOT NULL DEFAULT 0,
  190. rate_limiter_threshold int NOT NULL DEFAULT 0,
  191. description nvarchar(256) NOT NULL DEFAULT '',
  192. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  193. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  194. )
  195. GO
  196. CREATE INDEX idx_sj_notify_config_01 ON sj_notify_config (namespace_id, group_name, business_id)
  197. GO
  198. EXEC sp_addextendedproperty
  199. 'MS_Description', N'主键',
  200. 'SCHEMA', N'dbo',
  201. 'TABLE', N'sj_notify_config',
  202. 'COLUMN', N'id'
  203. GO
  204. EXEC sp_addextendedproperty
  205. 'MS_Description', N'命名空间id',
  206. 'SCHEMA', N'dbo',
  207. 'TABLE', N'sj_notify_config',
  208. 'COLUMN', N'namespace_id'
  209. GO
  210. EXEC sp_addextendedproperty
  211. 'MS_Description', N'组名称',
  212. 'SCHEMA', N'dbo',
  213. 'TABLE', N'sj_notify_config',
  214. 'COLUMN', N'group_name'
  215. GO
  216. EXEC sp_addextendedproperty
  217. 'MS_Description', N'业务id ( job_id或workflow_id或scene_name ) ',
  218. 'SCHEMA', N'dbo',
  219. 'TABLE', N'sj_notify_config',
  220. 'COLUMN', N'business_id'
  221. GO
  222. EXEC sp_addextendedproperty
  223. 'MS_Description', N'任务类型 1. 重试任务 2. 重试回调 3、JOB任务 4、WORKFLOW任务',
  224. 'SCHEMA', N'dbo',
  225. 'TABLE', N'sj_notify_config',
  226. 'COLUMN', N'system_task_type'
  227. GO
  228. EXEC sp_addextendedproperty
  229. 'MS_Description', N'通知状态 0、未启用 1、启用',
  230. 'SCHEMA', N'dbo',
  231. 'TABLE', N'sj_notify_config',
  232. 'COLUMN', N'notify_status'
  233. GO
  234. EXEC sp_addextendedproperty
  235. 'MS_Description', N'接收人id列表',
  236. 'SCHEMA', N'dbo',
  237. 'TABLE', N'sj_notify_config',
  238. 'COLUMN', N'recipient_ids'
  239. GO
  240. EXEC sp_addextendedproperty
  241. 'MS_Description', N'通知阈值',
  242. 'SCHEMA', N'dbo',
  243. 'TABLE', N'sj_notify_config',
  244. 'COLUMN', N'notify_threshold'
  245. GO
  246. EXEC sp_addextendedproperty
  247. 'MS_Description', N'通知场景',
  248. 'SCHEMA', N'dbo',
  249. 'TABLE', N'sj_notify_config',
  250. 'COLUMN', N'notify_scene'
  251. GO
  252. EXEC sp_addextendedproperty
  253. 'MS_Description', N'限流状态 0、未启用 1、启用',
  254. 'SCHEMA', N'dbo',
  255. 'TABLE', N'sj_notify_config',
  256. 'COLUMN', N'rate_limiter_status'
  257. GO
  258. EXEC sp_addextendedproperty
  259. 'MS_Description', N'每秒限流阈值',
  260. 'SCHEMA', N'dbo',
  261. 'TABLE', N'sj_notify_config',
  262. 'COLUMN', N'rate_limiter_threshold'
  263. GO
  264. EXEC sp_addextendedproperty
  265. 'MS_Description', N'描述',
  266. 'SCHEMA', N'dbo',
  267. 'TABLE', N'sj_notify_config',
  268. 'COLUMN', N'description'
  269. GO
  270. EXEC sp_addextendedproperty
  271. 'MS_Description', N'创建时间',
  272. 'SCHEMA', N'dbo',
  273. 'TABLE', N'sj_notify_config',
  274. 'COLUMN', N'create_dt'
  275. GO
  276. EXEC sp_addextendedproperty
  277. 'MS_Description', N'修改时间',
  278. 'SCHEMA', N'dbo',
  279. 'TABLE', N'sj_notify_config',
  280. 'COLUMN', N'update_dt'
  281. GO
  282. EXEC sp_addextendedproperty
  283. 'MS_Description', N'通知配置',
  284. 'SCHEMA', N'dbo',
  285. 'TABLE', N'sj_notify_config'
  286. GO
  287. -- sj_notify_recipient
  288. CREATE TABLE sj_notify_recipient
  289. (
  290. id bigint NOT NULL PRIMARY KEY IDENTITY,
  291. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  292. recipient_name nvarchar(64) NOT NULL,
  293. notify_type tinyint NOT NULL DEFAULT 0,
  294. notify_attribute nvarchar(512) NOT NULL,
  295. description nvarchar(256) NOT NULL DEFAULT '',
  296. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  297. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  298. )
  299. GO
  300. CREATE INDEX idx_sj_notify_recipient_01 ON sj_notify_recipient (namespace_id)
  301. GO
  302. EXEC sp_addextendedproperty
  303. 'MS_Description', N'主键',
  304. 'SCHEMA', N'dbo',
  305. 'TABLE', N'sj_notify_recipient',
  306. 'COLUMN', N'id'
  307. GO
  308. EXEC sp_addextendedproperty
  309. 'MS_Description', N'命名空间id',
  310. 'SCHEMA', N'dbo',
  311. 'TABLE', N'sj_notify_recipient',
  312. 'COLUMN', N'namespace_id'
  313. GO
  314. EXEC sp_addextendedproperty
  315. 'MS_Description', N'接收人名称',
  316. 'SCHEMA', N'dbo',
  317. 'TABLE', N'sj_notify_recipient',
  318. 'COLUMN', N'recipient_name'
  319. GO
  320. EXEC sp_addextendedproperty
  321. 'MS_Description', N'通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书',
  322. 'SCHEMA', N'dbo',
  323. 'TABLE', N'sj_notify_recipient',
  324. 'COLUMN', N'notify_type'
  325. GO
  326. EXEC sp_addextendedproperty
  327. 'MS_Description', N'配置属性',
  328. 'SCHEMA', N'dbo',
  329. 'TABLE', N'sj_notify_recipient',
  330. 'COLUMN', N'notify_attribute'
  331. GO
  332. EXEC sp_addextendedproperty
  333. 'MS_Description', N'描述',
  334. 'SCHEMA', N'dbo',
  335. 'TABLE', N'sj_notify_recipient',
  336. 'COLUMN', N'description'
  337. GO
  338. EXEC sp_addextendedproperty
  339. 'MS_Description', N'创建时间',
  340. 'SCHEMA', N'dbo',
  341. 'TABLE', N'sj_notify_recipient',
  342. 'COLUMN', N'create_dt'
  343. GO
  344. EXEC sp_addextendedproperty
  345. 'MS_Description', N'修改时间',
  346. 'SCHEMA', N'dbo',
  347. 'TABLE', N'sj_notify_recipient',
  348. 'COLUMN', N'update_dt'
  349. GO
  350. EXEC sp_addextendedproperty
  351. 'MS_Description', N'告警通知接收人',
  352. 'SCHEMA', N'dbo',
  353. 'TABLE', N'sj_notify_recipient'
  354. GO
  355. -- sj_retry_dead_letter_0
  356. CREATE TABLE sj_retry_dead_letter_0
  357. (
  358. id bigint NOT NULL PRIMARY KEY IDENTITY,
  359. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  360. unique_id nvarchar(64) NOT NULL,
  361. group_name nvarchar(64) NOT NULL,
  362. scene_name nvarchar(64) NOT NULL,
  363. idempotent_id nvarchar(64) NOT NULL,
  364. biz_no nvarchar(64) NOT NULL DEFAULT '',
  365. executor_name nvarchar(512) NOT NULL DEFAULT '',
  366. args_str nvarchar(max) NOT NULL,
  367. ext_attrs nvarchar(max) NOT NULL,
  368. task_type tinyint NOT NULL DEFAULT 1,
  369. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  370. )
  371. GO
  372. CREATE UNIQUE INDEX uk_sj_retry_dead_letter_0_01 ON sj_retry_dead_letter_0 (namespace_id, group_name, unique_id)
  373. GO
  374. CREATE INDEX idx_sj_retry_dead_letter_0_01 ON sj_retry_dead_letter_0 (namespace_id, group_name, scene_name)
  375. GO
  376. CREATE INDEX idx_sj_retry_dead_letter_0_02 ON sj_retry_dead_letter_0 (idempotent_id)
  377. GO
  378. CREATE INDEX idx_sj_retry_dead_letter_0_03 ON sj_retry_dead_letter_0 (biz_no)
  379. GO
  380. CREATE INDEX idx_sj_retry_dead_letter_0_04 ON sj_retry_dead_letter_0 (create_dt)
  381. GO
  382. EXEC sp_addextendedproperty
  383. 'MS_Description', N'主键',
  384. 'SCHEMA', N'dbo',
  385. 'TABLE', N'sj_retry_dead_letter_0',
  386. 'COLUMN', N'id'
  387. GO
  388. EXEC sp_addextendedproperty
  389. 'MS_Description', N'命名空间id',
  390. 'SCHEMA', N'dbo',
  391. 'TABLE', N'sj_retry_dead_letter_0',
  392. 'COLUMN', N'namespace_id'
  393. GO
  394. EXEC sp_addextendedproperty
  395. 'MS_Description', N'同组下id唯一',
  396. 'SCHEMA', N'dbo',
  397. 'TABLE', N'sj_retry_dead_letter_0',
  398. 'COLUMN', N'unique_id'
  399. GO
  400. EXEC sp_addextendedproperty
  401. 'MS_Description', N'组名称',
  402. 'SCHEMA', N'dbo',
  403. 'TABLE', N'sj_retry_dead_letter_0',
  404. 'COLUMN', N'group_name'
  405. GO
  406. EXEC sp_addextendedproperty
  407. 'MS_Description', N'场景名称',
  408. 'SCHEMA', N'dbo',
  409. 'TABLE', N'sj_retry_dead_letter_0',
  410. 'COLUMN', N'scene_name'
  411. GO
  412. EXEC sp_addextendedproperty
  413. 'MS_Description', N'幂等id',
  414. 'SCHEMA', N'dbo',
  415. 'TABLE', N'sj_retry_dead_letter_0',
  416. 'COLUMN', N'idempotent_id'
  417. GO
  418. EXEC sp_addextendedproperty
  419. 'MS_Description', N'业务编号',
  420. 'SCHEMA', N'dbo',
  421. 'TABLE', N'sj_retry_dead_letter_0',
  422. 'COLUMN', N'biz_no'
  423. GO
  424. EXEC sp_addextendedproperty
  425. 'MS_Description', N'执行器名称',
  426. 'SCHEMA', N'dbo',
  427. 'TABLE', N'sj_retry_dead_letter_0',
  428. 'COLUMN', N'executor_name'
  429. GO
  430. EXEC sp_addextendedproperty
  431. 'MS_Description', N'执行方法参数',
  432. 'SCHEMA', N'dbo',
  433. 'TABLE', N'sj_retry_dead_letter_0',
  434. 'COLUMN', N'args_str'
  435. GO
  436. EXEC sp_addextendedproperty
  437. 'MS_Description', N'扩展字段',
  438. 'SCHEMA', N'dbo',
  439. 'TABLE', N'sj_retry_dead_letter_0',
  440. 'COLUMN', N'ext_attrs'
  441. GO
  442. EXEC sp_addextendedproperty
  443. 'MS_Description', N'任务类型 1、重试数据 2、回调数据',
  444. 'SCHEMA', N'dbo',
  445. 'TABLE', N'sj_retry_dead_letter_0',
  446. 'COLUMN', N'task_type'
  447. GO
  448. EXEC sp_addextendedproperty
  449. 'MS_Description', N'创建时间',
  450. 'SCHEMA', N'dbo',
  451. 'TABLE', N'sj_retry_dead_letter_0',
  452. 'COLUMN', N'create_dt'
  453. GO
  454. EXEC sp_addextendedproperty
  455. 'MS_Description', N'死信队列表',
  456. 'SCHEMA', N'dbo',
  457. 'TABLE', N'sj_retry_dead_letter_0'
  458. GO
  459. -- sj_retry_task_0
  460. CREATE TABLE sj_retry_task_0
  461. (
  462. id bigint NOT NULL PRIMARY KEY IDENTITY,
  463. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  464. unique_id nvarchar(64) NOT NULL,
  465. group_name nvarchar(64) NOT NULL,
  466. scene_name nvarchar(64) NOT NULL,
  467. idempotent_id nvarchar(64) NOT NULL,
  468. biz_no nvarchar(64) NOT NULL DEFAULT '',
  469. executor_name nvarchar(512) NOT NULL DEFAULT '',
  470. args_str nvarchar(max) NOT NULL,
  471. ext_attrs nvarchar(max) NOT NULL,
  472. next_trigger_at datetime2 NOT NULL,
  473. retry_count int NOT NULL DEFAULT 0,
  474. retry_status tinyint NOT NULL DEFAULT 0,
  475. task_type tinyint NOT NULL DEFAULT 1,
  476. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  477. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  478. )
  479. GO
  480. CREATE UNIQUE INDEX uk_sj_retry_task_0_01 ON sj_retry_task_0 (namespace_id, group_name, unique_id)
  481. GO
  482. CREATE INDEX idx_sj_retry_task_0_01 ON sj_retry_task_0 (namespace_id, group_name, scene_name)
  483. GO
  484. CREATE INDEX idx_sj_retry_task_0_02 ON sj_retry_task_0 (namespace_id, group_name, task_type)
  485. GO
  486. CREATE INDEX idx_sj_retry_task_0_03 ON sj_retry_task_0 (namespace_id, group_name, retry_status)
  487. GO
  488. CREATE INDEX idx_sj_retry_task_0_04 ON sj_retry_task_0 (idempotent_id)
  489. GO
  490. CREATE INDEX idx_sj_retry_task_0_05 ON sj_retry_task_0 (biz_no)
  491. GO
  492. CREATE INDEX idx_sj_retry_task_0_06 ON sj_retry_task_0 (create_dt)
  493. GO
  494. EXEC sp_addextendedproperty
  495. 'MS_Description', N'主键',
  496. 'SCHEMA', N'dbo',
  497. 'TABLE', N'sj_retry_task_0',
  498. 'COLUMN', N'id'
  499. GO
  500. EXEC sp_addextendedproperty
  501. 'MS_Description', N'命名空间id',
  502. 'SCHEMA', N'dbo',
  503. 'TABLE', N'sj_retry_task_0',
  504. 'COLUMN', N'namespace_id'
  505. GO
  506. EXEC sp_addextendedproperty
  507. 'MS_Description', N'同组下id唯一',
  508. 'SCHEMA', N'dbo',
  509. 'TABLE', N'sj_retry_task_0',
  510. 'COLUMN', N'unique_id'
  511. GO
  512. EXEC sp_addextendedproperty
  513. 'MS_Description', N'组名称',
  514. 'SCHEMA', N'dbo',
  515. 'TABLE', N'sj_retry_task_0',
  516. 'COLUMN', N'group_name'
  517. GO
  518. EXEC sp_addextendedproperty
  519. 'MS_Description', N'场景名称',
  520. 'SCHEMA', N'dbo',
  521. 'TABLE', N'sj_retry_task_0',
  522. 'COLUMN', N'scene_name'
  523. GO
  524. EXEC sp_addextendedproperty
  525. 'MS_Description', N'幂等id',
  526. 'SCHEMA', N'dbo',
  527. 'TABLE', N'sj_retry_task_0',
  528. 'COLUMN', N'idempotent_id'
  529. GO
  530. EXEC sp_addextendedproperty
  531. 'MS_Description', N'业务编号',
  532. 'SCHEMA', N'dbo',
  533. 'TABLE', N'sj_retry_task_0',
  534. 'COLUMN', N'biz_no'
  535. GO
  536. EXEC sp_addextendedproperty
  537. 'MS_Description', N'执行器名称',
  538. 'SCHEMA', N'dbo',
  539. 'TABLE', N'sj_retry_task_0',
  540. 'COLUMN', N'executor_name'
  541. GO
  542. EXEC sp_addextendedproperty
  543. 'MS_Description', N'执行方法参数',
  544. 'SCHEMA', N'dbo',
  545. 'TABLE', N'sj_retry_task_0',
  546. 'COLUMN', N'args_str'
  547. GO
  548. EXEC sp_addextendedproperty
  549. 'MS_Description', N'扩展字段',
  550. 'SCHEMA', N'dbo',
  551. 'TABLE', N'sj_retry_task_0',
  552. 'COLUMN', N'ext_attrs'
  553. GO
  554. EXEC sp_addextendedproperty
  555. 'MS_Description', N'下次触发时间',
  556. 'SCHEMA', N'dbo',
  557. 'TABLE', N'sj_retry_task_0',
  558. 'COLUMN', N'next_trigger_at'
  559. GO
  560. EXEC sp_addextendedproperty
  561. 'MS_Description', N'重试次数',
  562. 'SCHEMA', N'dbo',
  563. 'TABLE', N'sj_retry_task_0',
  564. 'COLUMN', N'retry_count'
  565. GO
  566. EXEC sp_addextendedproperty
  567. 'MS_Description', N'重试状态 0、重试中 1、成功 2、最大重试次数',
  568. 'SCHEMA', N'dbo',
  569. 'TABLE', N'sj_retry_task_0',
  570. 'COLUMN', N'retry_status'
  571. GO
  572. EXEC sp_addextendedproperty
  573. 'MS_Description', N'任务类型 1、重试数据 2、回调数据',
  574. 'SCHEMA', N'dbo',
  575. 'TABLE', N'sj_retry_task_0',
  576. 'COLUMN', N'task_type'
  577. GO
  578. EXEC sp_addextendedproperty
  579. 'MS_Description', N'创建时间',
  580. 'SCHEMA', N'dbo',
  581. 'TABLE', N'sj_retry_task_0',
  582. 'COLUMN', N'create_dt'
  583. GO
  584. EXEC sp_addextendedproperty
  585. 'MS_Description', N'修改时间',
  586. 'SCHEMA', N'dbo',
  587. 'TABLE', N'sj_retry_task_0',
  588. 'COLUMN', N'update_dt'
  589. GO
  590. EXEC sp_addextendedproperty
  591. 'MS_Description', N'任务表',
  592. 'SCHEMA', N'dbo',
  593. 'TABLE', N'sj_retry_task_0'
  594. GO
  595. -- sj_retry_task_log
  596. CREATE TABLE sj_retry_task_log
  597. (
  598. id bigint NOT NULL PRIMARY KEY IDENTITY,
  599. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  600. unique_id nvarchar(64) NOT NULL,
  601. group_name nvarchar(64) NOT NULL,
  602. scene_name nvarchar(64) NOT NULL,
  603. idempotent_id nvarchar(64) NOT NULL,
  604. biz_no nvarchar(64) NOT NULL DEFAULT '',
  605. executor_name nvarchar(512) NOT NULL DEFAULT '',
  606. args_str nvarchar(max) NOT NULL,
  607. ext_attrs nvarchar(max) NOT NULL,
  608. retry_status tinyint NOT NULL DEFAULT 0,
  609. task_type tinyint NOT NULL DEFAULT 1,
  610. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  611. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  612. )
  613. GO
  614. CREATE INDEX idx_sj_retry_task_log_01 ON sj_retry_task_log (namespace_id, group_name, scene_name)
  615. GO
  616. CREATE INDEX idx_sj_retry_task_log_02 ON sj_retry_task_log (retry_status)
  617. GO
  618. CREATE INDEX idx_sj_retry_task_log_03 ON sj_retry_task_log (idempotent_id)
  619. GO
  620. CREATE INDEX idx_sj_retry_task_log_04 ON sj_retry_task_log (unique_id)
  621. GO
  622. CREATE INDEX idx_sj_retry_task_log_05 ON sj_retry_task_log (biz_no)
  623. GO
  624. CREATE INDEX idx_sj_retry_task_log_06 ON sj_retry_task_log (create_dt)
  625. GO
  626. EXEC sp_addextendedproperty
  627. 'MS_Description', N'主键',
  628. 'SCHEMA', N'dbo',
  629. 'TABLE', N'sj_retry_task_log',
  630. 'COLUMN', N'id'
  631. GO
  632. EXEC sp_addextendedproperty
  633. 'MS_Description', N'命名空间id',
  634. 'SCHEMA', N'dbo',
  635. 'TABLE', N'sj_retry_task_log',
  636. 'COLUMN', N'namespace_id'
  637. GO
  638. EXEC sp_addextendedproperty
  639. 'MS_Description', N'同组下id唯一',
  640. 'SCHEMA', N'dbo',
  641. 'TABLE', N'sj_retry_task_log',
  642. 'COLUMN', N'unique_id'
  643. GO
  644. EXEC sp_addextendedproperty
  645. 'MS_Description', N'组名称',
  646. 'SCHEMA', N'dbo',
  647. 'TABLE', N'sj_retry_task_log',
  648. 'COLUMN', N'group_name'
  649. GO
  650. EXEC sp_addextendedproperty
  651. 'MS_Description', N'场景名称',
  652. 'SCHEMA', N'dbo',
  653. 'TABLE', N'sj_retry_task_log',
  654. 'COLUMN', N'scene_name'
  655. GO
  656. EXEC sp_addextendedproperty
  657. 'MS_Description', N'幂等id',
  658. 'SCHEMA', N'dbo',
  659. 'TABLE', N'sj_retry_task_log',
  660. 'COLUMN', N'idempotent_id'
  661. GO
  662. EXEC sp_addextendedproperty
  663. 'MS_Description', N'业务编号',
  664. 'SCHEMA', N'dbo',
  665. 'TABLE', N'sj_retry_task_log',
  666. 'COLUMN', N'biz_no'
  667. GO
  668. EXEC sp_addextendedproperty
  669. 'MS_Description', N'执行器名称',
  670. 'SCHEMA', N'dbo',
  671. 'TABLE', N'sj_retry_task_log',
  672. 'COLUMN', N'executor_name'
  673. GO
  674. EXEC sp_addextendedproperty
  675. 'MS_Description', N'执行方法参数',
  676. 'SCHEMA', N'dbo',
  677. 'TABLE', N'sj_retry_task_log',
  678. 'COLUMN', N'args_str'
  679. GO
  680. EXEC sp_addextendedproperty
  681. 'MS_Description', N'扩展字段',
  682. 'SCHEMA', N'dbo',
  683. 'TABLE', N'sj_retry_task_log',
  684. 'COLUMN', N'ext_attrs'
  685. GO
  686. EXEC sp_addextendedproperty
  687. 'MS_Description', N'重试状态 0、重试中 1、成功 2、最大次数',
  688. 'SCHEMA', N'dbo',
  689. 'TABLE', N'sj_retry_task_log',
  690. 'COLUMN', N'retry_status'
  691. GO
  692. EXEC sp_addextendedproperty
  693. 'MS_Description', N'任务类型 1、重试数据 2、回调数据',
  694. 'SCHEMA', N'dbo',
  695. 'TABLE', N'sj_retry_task_log',
  696. 'COLUMN', N'task_type'
  697. GO
  698. EXEC sp_addextendedproperty
  699. 'MS_Description', N'创建时间',
  700. 'SCHEMA', N'dbo',
  701. 'TABLE', N'sj_retry_task_log',
  702. 'COLUMN', N'create_dt'
  703. GO
  704. EXEC sp_addextendedproperty
  705. 'MS_Description', N'修改时间',
  706. 'SCHEMA', N'dbo',
  707. 'TABLE', N'sj_retry_task_log',
  708. 'COLUMN', N'update_dt'
  709. GO
  710. EXEC sp_addextendedproperty
  711. 'MS_Description', N'任务日志基础信息表',
  712. 'SCHEMA', N'dbo',
  713. 'TABLE', N'sj_retry_task_log'
  714. GO
  715. -- sj_retry_task_log_message
  716. CREATE TABLE sj_retry_task_log_message
  717. (
  718. id bigint NOT NULL PRIMARY KEY IDENTITY,
  719. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  720. group_name nvarchar(64) NOT NULL,
  721. unique_id nvarchar(64) NOT NULL,
  722. message nvarchar(max) NOT NULL,
  723. log_num int NOT NULL DEFAULT 1,
  724. real_time bigint NOT NULL DEFAULT 0,
  725. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  726. )
  727. GO
  728. CREATE INDEX idx_sj_retry_task_log_message_01 ON sj_retry_task_log_message (namespace_id, group_name, unique_id)
  729. GO
  730. CREATE INDEX idx_sj_retry_task_log_message_02 ON sj_retry_task_log_message (create_dt)
  731. GO
  732. EXEC sp_addextendedproperty
  733. 'MS_Description', N'主键',
  734. 'SCHEMA', N'dbo',
  735. 'TABLE', N'sj_retry_task_log_message',
  736. 'COLUMN', N'id'
  737. GO
  738. EXEC sp_addextendedproperty
  739. 'MS_Description', N'命名空间id',
  740. 'SCHEMA', N'dbo',
  741. 'TABLE', N'sj_retry_task_log_message',
  742. 'COLUMN', N'namespace_id'
  743. GO
  744. EXEC sp_addextendedproperty
  745. 'MS_Description', N'组名称',
  746. 'SCHEMA', N'dbo',
  747. 'TABLE', N'sj_retry_task_log_message',
  748. 'COLUMN', N'group_name'
  749. GO
  750. EXEC sp_addextendedproperty
  751. 'MS_Description', N'同组下id唯一',
  752. 'SCHEMA', N'dbo',
  753. 'TABLE', N'sj_retry_task_log_message',
  754. 'COLUMN', N'unique_id'
  755. GO
  756. EXEC sp_addextendedproperty
  757. 'MS_Description', N'异常信息',
  758. 'SCHEMA', N'dbo',
  759. 'TABLE', N'sj_retry_task_log_message',
  760. 'COLUMN', N'message'
  761. GO
  762. EXEC sp_addextendedproperty
  763. 'MS_Description', N'日志数量',
  764. 'SCHEMA', N'dbo',
  765. 'TABLE', N'sj_retry_task_log_message',
  766. 'COLUMN', N'log_num'
  767. GO
  768. EXEC sp_addextendedproperty
  769. 'MS_Description', N'上报时间',
  770. 'SCHEMA', N'dbo',
  771. 'TABLE', N'sj_retry_task_log_message',
  772. 'COLUMN', N'real_time'
  773. GO
  774. EXEC sp_addextendedproperty
  775. 'MS_Description', N'创建时间',
  776. 'SCHEMA', N'dbo',
  777. 'TABLE', N'sj_retry_task_log_message',
  778. 'COLUMN', N'create_dt'
  779. GO
  780. EXEC sp_addextendedproperty
  781. 'MS_Description', N'任务调度日志信息记录表',
  782. 'SCHEMA', N'dbo',
  783. 'TABLE', N'sj_retry_task_log_message'
  784. GO
  785. -- sj_retry_scene_config
  786. CREATE TABLE sj_retry_scene_config
  787. (
  788. id bigint NOT NULL PRIMARY KEY IDENTITY,
  789. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  790. scene_name nvarchar(64) NOT NULL,
  791. group_name nvarchar(64) NOT NULL,
  792. scene_status tinyint NOT NULL DEFAULT 0,
  793. max_retry_count int NOT NULL DEFAULT 5,
  794. back_off tinyint NOT NULL DEFAULT 1,
  795. trigger_interval nvarchar(16) NOT NULL DEFAULT '',
  796. deadline_request bigint NOT NULL DEFAULT 60000,
  797. executor_timeout int NOT NULL DEFAULT 5,
  798. route_key tinyint NOT NULL DEFAULT 4,
  799. description nvarchar(256) NOT NULL DEFAULT '',
  800. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  801. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  802. )
  803. GO
  804. CREATE UNIQUE INDEX uk_sj_retry_scene_config_01 ON sj_retry_scene_config (namespace_id, group_name, scene_name)
  805. GO
  806. EXEC sp_addextendedproperty
  807. 'MS_Description', N'主键',
  808. 'SCHEMA', N'dbo',
  809. 'TABLE', N'sj_retry_scene_config',
  810. 'COLUMN', N'id'
  811. GO
  812. EXEC sp_addextendedproperty
  813. 'MS_Description', N'命名空间id',
  814. 'SCHEMA', N'dbo',
  815. 'TABLE', N'sj_retry_scene_config',
  816. 'COLUMN', N'namespace_id'
  817. GO
  818. EXEC sp_addextendedproperty
  819. 'MS_Description', N'场景名称',
  820. 'SCHEMA', N'dbo',
  821. 'TABLE', N'sj_retry_scene_config',
  822. 'COLUMN', N'scene_name'
  823. GO
  824. EXEC sp_addextendedproperty
  825. 'MS_Description', N'组名称',
  826. 'SCHEMA', N'dbo',
  827. 'TABLE', N'sj_retry_scene_config',
  828. 'COLUMN', N'group_name'
  829. GO
  830. EXEC sp_addextendedproperty
  831. 'MS_Description', N'组状态 0、未启用 1、启用',
  832. 'SCHEMA', N'dbo',
  833. 'TABLE', N'sj_retry_scene_config',
  834. 'COLUMN', N'scene_status'
  835. GO
  836. EXEC sp_addextendedproperty
  837. 'MS_Description', N'最大重试次数',
  838. 'SCHEMA', N'dbo',
  839. 'TABLE', N'sj_retry_scene_config',
  840. 'COLUMN', N'max_retry_count'
  841. GO
  842. EXEC sp_addextendedproperty
  843. 'MS_Description', N'1、默认等级 2、固定间隔时间 3、CRON 表达式',
  844. 'SCHEMA', N'dbo',
  845. 'TABLE', N'sj_retry_scene_config',
  846. 'COLUMN', N'back_off'
  847. GO
  848. EXEC sp_addextendedproperty
  849. 'MS_Description', N'间隔时长',
  850. 'SCHEMA', N'dbo',
  851. 'TABLE', N'sj_retry_scene_config',
  852. 'COLUMN', N'trigger_interval'
  853. GO
  854. EXEC sp_addextendedproperty
  855. 'MS_Description', N'Deadline Request 调用链超时 单位毫秒',
  856. 'SCHEMA', N'dbo',
  857. 'TABLE', N'sj_retry_scene_config',
  858. 'COLUMN', N'deadline_request'
  859. GO
  860. EXEC sp_addextendedproperty
  861. 'MS_Description', N'任务执行超时时间,单位秒',
  862. 'SCHEMA', N'dbo',
  863. 'TABLE', N'sj_retry_scene_config',
  864. 'COLUMN', N'executor_timeout'
  865. GO
  866. EXEC sp_addextendedproperty
  867. 'MS_Description', N'路由策略',
  868. 'SCHEMA', N'dbo',
  869. 'TABLE', N'sj_retry_scene_config',
  870. 'COLUMN', N'route_key'
  871. GO
  872. EXEC sp_addextendedproperty
  873. 'MS_Description', N'描述',
  874. 'SCHEMA', N'dbo',
  875. 'TABLE', N'sj_retry_scene_config',
  876. 'COLUMN', N'description'
  877. GO
  878. EXEC sp_addextendedproperty
  879. 'MS_Description', N'创建时间',
  880. 'SCHEMA', N'dbo',
  881. 'TABLE', N'sj_retry_scene_config',
  882. 'COLUMN', N'create_dt'
  883. GO
  884. EXEC sp_addextendedproperty
  885. 'MS_Description', N'修改时间',
  886. 'SCHEMA', N'dbo',
  887. 'TABLE', N'sj_retry_scene_config',
  888. 'COLUMN', N'update_dt'
  889. GO
  890. EXEC sp_addextendedproperty
  891. 'MS_Description', N'场景配置',
  892. 'SCHEMA', N'dbo',
  893. 'TABLE', N'sj_retry_scene_config'
  894. GO
  895. -- sj_server_node
  896. CREATE TABLE sj_server_node
  897. (
  898. id bigint NOT NULL PRIMARY KEY IDENTITY,
  899. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  900. group_name nvarchar(64) NOT NULL,
  901. host_id nvarchar(64) NOT NULL,
  902. host_ip nvarchar(64) NOT NULL,
  903. host_port int NOT NULL,
  904. expire_at datetime2 NOT NULL,
  905. node_type tinyint NOT NULL,
  906. ext_attrs nvarchar(256) NULL DEFAULT '',
  907. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  908. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  909. )
  910. GO
  911. CREATE UNIQUE INDEX uk_sj_server_node_01 ON sj_server_node (host_id, host_ip)
  912. GO
  913. CREATE INDEX idx_sj_server_node_01 ON sj_server_node (namespace_id, group_name)
  914. GO
  915. CREATE INDEX idx_sj_server_node_02 ON sj_server_node (expire_at, node_type)
  916. GO
  917. EXEC sp_addextendedproperty
  918. 'MS_Description', N'主键',
  919. 'SCHEMA', N'dbo',
  920. 'TABLE', N'sj_server_node',
  921. 'COLUMN', N'id'
  922. GO
  923. EXEC sp_addextendedproperty
  924. 'MS_Description', N'命名空间id',
  925. 'SCHEMA', N'dbo',
  926. 'TABLE', N'sj_server_node',
  927. 'COLUMN', N'namespace_id'
  928. GO
  929. EXEC sp_addextendedproperty
  930. 'MS_Description', N'组名称',
  931. 'SCHEMA', N'dbo',
  932. 'TABLE', N'sj_server_node',
  933. 'COLUMN', N'group_name'
  934. GO
  935. EXEC sp_addextendedproperty
  936. 'MS_Description', N'主机id',
  937. 'SCHEMA', N'dbo',
  938. 'TABLE', N'sj_server_node',
  939. 'COLUMN', N'host_id'
  940. GO
  941. EXEC sp_addextendedproperty
  942. 'MS_Description', N'机器ip',
  943. 'SCHEMA', N'dbo',
  944. 'TABLE', N'sj_server_node',
  945. 'COLUMN', N'host_ip'
  946. GO
  947. EXEC sp_addextendedproperty
  948. 'MS_Description', N'机器端口',
  949. 'SCHEMA', N'dbo',
  950. 'TABLE', N'sj_server_node',
  951. 'COLUMN', N'host_port'
  952. GO
  953. EXEC sp_addextendedproperty
  954. 'MS_Description', N'过期时间',
  955. 'SCHEMA', N'dbo',
  956. 'TABLE', N'sj_server_node',
  957. 'COLUMN', N'expire_at'
  958. GO
  959. EXEC sp_addextendedproperty
  960. 'MS_Description', N'节点类型 1、客户端 2、是服务端',
  961. 'SCHEMA', N'dbo',
  962. 'TABLE', N'sj_server_node',
  963. 'COLUMN', N'node_type'
  964. GO
  965. EXEC sp_addextendedproperty
  966. 'MS_Description', N'扩展字段',
  967. 'SCHEMA', N'dbo',
  968. 'TABLE', N'sj_server_node',
  969. 'COLUMN', N'ext_attrs'
  970. GO
  971. EXEC sp_addextendedproperty
  972. 'MS_Description', N'创建时间',
  973. 'SCHEMA', N'dbo',
  974. 'TABLE', N'sj_server_node',
  975. 'COLUMN', N'create_dt'
  976. GO
  977. EXEC sp_addextendedproperty
  978. 'MS_Description', N'修改时间',
  979. 'SCHEMA', N'dbo',
  980. 'TABLE', N'sj_server_node',
  981. 'COLUMN', N'update_dt'
  982. GO
  983. EXEC sp_addextendedproperty
  984. 'MS_Description', N'服务器节点',
  985. 'SCHEMA', N'dbo',
  986. 'TABLE', N'sj_server_node'
  987. GO
  988. -- sj_distributed_lock
  989. CREATE TABLE sj_distributed_lock
  990. (
  991. id bigint NOT NULL PRIMARY KEY IDENTITY,
  992. name nvarchar(64) NOT NULL,
  993. lock_until datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  994. locked_at datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  995. locked_by nvarchar(255) NOT NULL,
  996. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  997. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  998. )
  999. GO
  1000. EXEC sp_addextendedproperty
  1001. 'MS_Description', N'主键',
  1002. 'SCHEMA', N'dbo',
  1003. 'TABLE', N'sj_distributed_lock',
  1004. 'COLUMN', N'id'
  1005. GO
  1006. EXEC sp_addextendedproperty
  1007. 'MS_Description', N'锁名称',
  1008. 'SCHEMA', N'dbo',
  1009. 'TABLE', N'sj_distributed_lock',
  1010. 'COLUMN', N'name'
  1011. GO
  1012. EXEC sp_addextendedproperty
  1013. 'MS_Description', N'锁定时长',
  1014. 'SCHEMA', N'dbo',
  1015. 'TABLE', N'sj_distributed_lock',
  1016. 'COLUMN', N'lock_until'
  1017. GO
  1018. EXEC sp_addextendedproperty
  1019. 'MS_Description', N'锁定时间',
  1020. 'SCHEMA', N'dbo',
  1021. 'TABLE', N'sj_distributed_lock',
  1022. 'COLUMN', N'locked_at'
  1023. GO
  1024. EXEC sp_addextendedproperty
  1025. 'MS_Description', N'锁定者',
  1026. 'SCHEMA', N'dbo',
  1027. 'TABLE', N'sj_distributed_lock',
  1028. 'COLUMN', N'locked_by'
  1029. GO
  1030. EXEC sp_addextendedproperty
  1031. 'MS_Description', N'创建时间',
  1032. 'SCHEMA', N'dbo',
  1033. 'TABLE', N'sj_distributed_lock',
  1034. 'COLUMN', N'create_dt'
  1035. GO
  1036. EXEC sp_addextendedproperty
  1037. 'MS_Description', N'修改时间',
  1038. 'SCHEMA', N'dbo',
  1039. 'TABLE', N'sj_distributed_lock',
  1040. 'COLUMN', N'update_dt'
  1041. GO
  1042. EXEC sp_addextendedproperty
  1043. 'MS_Description', N'锁定表',
  1044. 'SCHEMA', N'dbo',
  1045. 'TABLE', N'sj_distributed_lock'
  1046. GO
  1047. -- sj_system_user
  1048. CREATE TABLE sj_system_user
  1049. (
  1050. id bigint NOT NULL PRIMARY KEY IDENTITY,
  1051. username nvarchar(64) NOT NULL,
  1052. password nvarchar(128) NOT NULL,
  1053. role tinyint NOT NULL DEFAULT 0,
  1054. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  1055. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  1056. )
  1057. GO
  1058. EXEC sp_addextendedproperty
  1059. 'MS_Description', N'主键',
  1060. 'SCHEMA', N'dbo',
  1061. 'TABLE', N'sj_system_user',
  1062. 'COLUMN', N'id'
  1063. GO
  1064. EXEC sp_addextendedproperty
  1065. 'MS_Description', N'账号',
  1066. 'SCHEMA', N'dbo',
  1067. 'TABLE', N'sj_system_user',
  1068. 'COLUMN', N'username'
  1069. GO
  1070. EXEC sp_addextendedproperty
  1071. 'MS_Description', N'密码',
  1072. 'SCHEMA', N'dbo',
  1073. 'TABLE', N'sj_system_user',
  1074. 'COLUMN', N'password'
  1075. GO
  1076. EXEC sp_addextendedproperty
  1077. 'MS_Description', N'角色:1-普通用户、2-管理员',
  1078. 'SCHEMA', N'dbo',
  1079. 'TABLE', N'sj_system_user',
  1080. 'COLUMN', N'role'
  1081. GO
  1082. EXEC sp_addextendedproperty
  1083. 'MS_Description', N'创建时间',
  1084. 'SCHEMA', N'dbo',
  1085. 'TABLE', N'sj_system_user',
  1086. 'COLUMN', N'create_dt'
  1087. GO
  1088. EXEC sp_addextendedproperty
  1089. 'MS_Description', N'修改时间',
  1090. 'SCHEMA', N'dbo',
  1091. 'TABLE', N'sj_system_user',
  1092. 'COLUMN', N'update_dt'
  1093. GO
  1094. EXEC sp_addextendedproperty
  1095. 'MS_Description', N'系统用户表',
  1096. 'SCHEMA', N'dbo',
  1097. 'TABLE', N'sj_system_user'
  1098. GO
  1099. -- pwd: admin
  1100. INSERT INTO sj_system_user(username, password, role, create_dt, update_dt) VALUES (N'admin', N'465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac', N'2', getdate(), getdate())
  1101. GO
  1102. -- sj_system_user_permission
  1103. CREATE TABLE sj_system_user_permission
  1104. (
  1105. id bigint NOT NULL PRIMARY KEY IDENTITY,
  1106. group_name nvarchar(64) NOT NULL,
  1107. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  1108. system_user_id bigint NOT NULL,
  1109. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  1110. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  1111. )
  1112. GO
  1113. CREATE UNIQUE INDEX uk_sj_system_user_permission_01 ON sj_system_user_permission (namespace_id, group_name, system_user_id)
  1114. GO
  1115. EXEC sp_addextendedproperty
  1116. 'MS_Description', N'主键',
  1117. 'SCHEMA', N'dbo',
  1118. 'TABLE', N'sj_system_user_permission',
  1119. 'COLUMN', N'id'
  1120. GO
  1121. EXEC sp_addextendedproperty
  1122. 'MS_Description', N'组名称',
  1123. 'SCHEMA', N'dbo',
  1124. 'TABLE', N'sj_system_user_permission',
  1125. 'COLUMN', N'group_name'
  1126. GO
  1127. EXEC sp_addextendedproperty
  1128. 'MS_Description', N'命名空间id',
  1129. 'SCHEMA', N'dbo',
  1130. 'TABLE', N'sj_system_user_permission',
  1131. 'COLUMN', N'namespace_id'
  1132. GO
  1133. EXEC sp_addextendedproperty
  1134. 'MS_Description', N'系统用户id',
  1135. 'SCHEMA', N'dbo',
  1136. 'TABLE', N'sj_system_user_permission',
  1137. 'COLUMN', N'system_user_id'
  1138. GO
  1139. EXEC sp_addextendedproperty
  1140. 'MS_Description', N'创建时间',
  1141. 'SCHEMA', N'dbo',
  1142. 'TABLE', N'sj_system_user_permission',
  1143. 'COLUMN', N'create_dt'
  1144. GO
  1145. EXEC sp_addextendedproperty
  1146. 'MS_Description', N'修改时间',
  1147. 'SCHEMA', N'dbo',
  1148. 'TABLE', N'sj_system_user_permission',
  1149. 'COLUMN', N'update_dt'
  1150. GO
  1151. EXEC sp_addextendedproperty
  1152. 'MS_Description', N'系统用户权限表',
  1153. 'SCHEMA', N'dbo',
  1154. 'TABLE', N'sj_system_user_permission'
  1155. GO
  1156. -- sj_sequence_alloc
  1157. CREATE TABLE sj_sequence_alloc
  1158. (
  1159. id bigint NOT NULL PRIMARY KEY IDENTITY,
  1160. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  1161. group_name nvarchar(64) NOT NULL DEFAULT '',
  1162. max_id bigint NOT NULL DEFAULT 1,
  1163. step int NOT NULL DEFAULT 100,
  1164. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  1165. )
  1166. GO
  1167. CREATE UNIQUE INDEX uk_sj_sequence_alloc_01 ON sj_sequence_alloc (namespace_id, group_name)
  1168. GO
  1169. EXEC sp_addextendedproperty
  1170. 'MS_Description', N'主键',
  1171. 'SCHEMA', N'dbo',
  1172. 'TABLE', N'sj_sequence_alloc',
  1173. 'COLUMN', N'id'
  1174. GO
  1175. EXEC sp_addextendedproperty
  1176. 'MS_Description', N'命名空间id',
  1177. 'SCHEMA', N'dbo',
  1178. 'TABLE', N'sj_sequence_alloc',
  1179. 'COLUMN', N'namespace_id'
  1180. GO
  1181. EXEC sp_addextendedproperty
  1182. 'MS_Description', N'组名称',
  1183. 'SCHEMA', N'dbo',
  1184. 'TABLE', N'sj_sequence_alloc',
  1185. 'COLUMN', N'group_name'
  1186. GO
  1187. EXEC sp_addextendedproperty
  1188. 'MS_Description', N'最大id',
  1189. 'SCHEMA', N'dbo',
  1190. 'TABLE', N'sj_sequence_alloc',
  1191. 'COLUMN', N'max_id'
  1192. GO
  1193. EXEC sp_addextendedproperty
  1194. 'MS_Description', N'步长',
  1195. 'SCHEMA', N'dbo',
  1196. 'TABLE', N'sj_sequence_alloc',
  1197. 'COLUMN', N'step'
  1198. GO
  1199. EXEC sp_addextendedproperty
  1200. 'MS_Description', N'更新时间',
  1201. 'SCHEMA', N'dbo',
  1202. 'TABLE', N'sj_sequence_alloc',
  1203. 'COLUMN', N'update_dt'
  1204. GO
  1205. EXEC sp_addextendedproperty
  1206. 'MS_Description', N'号段模式序号ID分配表',
  1207. 'SCHEMA', N'dbo',
  1208. 'TABLE', N'sj_sequence_alloc'
  1209. GO
  1210. -- sj_job
  1211. CREATE TABLE sj_job
  1212. (
  1213. id bigint NOT NULL PRIMARY KEY IDENTITY,
  1214. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  1215. group_name nvarchar(64) NOT NULL,
  1216. job_name nvarchar(64) NOT NULL,
  1217. args_str nvarchar(max) NULL DEFAULT NULL,
  1218. args_type tinyint NOT NULL DEFAULT 1,
  1219. next_trigger_at bigint NOT NULL,
  1220. job_status tinyint NOT NULL DEFAULT 1,
  1221. task_type tinyint NOT NULL DEFAULT 1,
  1222. route_key tinyint NOT NULL DEFAULT 4,
  1223. executor_type tinyint NOT NULL DEFAULT 1,
  1224. executor_info nvarchar(255) NULL DEFAULT NULL,
  1225. trigger_type tinyint NOT NULL,
  1226. trigger_interval nvarchar(255) NOT NULL,
  1227. block_strategy tinyint NOT NULL DEFAULT 1,
  1228. executor_timeout int NOT NULL DEFAULT 0,
  1229. max_retry_times int NOT NULL DEFAULT 0,
  1230. parallel_num int NOT NULL DEFAULT 1,
  1231. retry_interval int NOT NULL DEFAULT 0,
  1232. bucket_index int NOT NULL DEFAULT 0,
  1233. resident tinyint NOT NULL DEFAULT 0,
  1234. description nvarchar(256) NOT NULL DEFAULT '',
  1235. ext_attrs nvarchar(256) NULL DEFAULT '',
  1236. deleted tinyint NOT NULL DEFAULT 0,
  1237. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  1238. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  1239. )
  1240. GO
  1241. CREATE INDEX idx_sj_job_01 ON sj_job (namespace_id, group_name)
  1242. GO
  1243. CREATE INDEX idx_sj_job_02 ON sj_job (job_status, bucket_index)
  1244. GO
  1245. CREATE INDEX idx_sj_job_03 ON sj_job (create_dt)
  1246. GO
  1247. EXEC sp_addextendedproperty
  1248. 'MS_Description', N'主键',
  1249. 'SCHEMA', N'dbo',
  1250. 'TABLE', N'sj_job',
  1251. 'COLUMN', N'id'
  1252. GO
  1253. EXEC sp_addextendedproperty
  1254. 'MS_Description', N'命名空间id',
  1255. 'SCHEMA', N'dbo',
  1256. 'TABLE', N'sj_job',
  1257. 'COLUMN', N'namespace_id'
  1258. GO
  1259. EXEC sp_addextendedproperty
  1260. 'MS_Description', N'组名称',
  1261. 'SCHEMA', N'dbo',
  1262. 'TABLE', N'sj_job',
  1263. 'COLUMN', N'group_name'
  1264. GO
  1265. EXEC sp_addextendedproperty
  1266. 'MS_Description', N'名称',
  1267. 'SCHEMA', N'dbo',
  1268. 'TABLE', N'sj_job',
  1269. 'COLUMN', N'job_name'
  1270. GO
  1271. EXEC sp_addextendedproperty
  1272. 'MS_Description', N'执行方法参数',
  1273. 'SCHEMA', N'dbo',
  1274. 'TABLE', N'sj_job',
  1275. 'COLUMN', N'args_str'
  1276. GO
  1277. EXEC sp_addextendedproperty
  1278. 'MS_Description', N'参数类型 ',
  1279. 'SCHEMA', N'dbo',
  1280. 'TABLE', N'sj_job',
  1281. 'COLUMN', N'args_type'
  1282. GO
  1283. EXEC sp_addextendedproperty
  1284. 'MS_Description', N'下次触发时间',
  1285. 'SCHEMA', N'dbo',
  1286. 'TABLE', N'sj_job',
  1287. 'COLUMN', N'next_trigger_at'
  1288. GO
  1289. EXEC sp_addextendedproperty
  1290. 'MS_Description', N'任务状态 0、关闭、1、开启',
  1291. 'SCHEMA', N'dbo',
  1292. 'TABLE', N'sj_job',
  1293. 'COLUMN', N'job_status'
  1294. GO
  1295. EXEC sp_addextendedproperty
  1296. 'MS_Description', N'任务类型 1、集群 2、广播 3、切片',
  1297. 'SCHEMA', N'dbo',
  1298. 'TABLE', N'sj_job',
  1299. 'COLUMN', N'task_type'
  1300. GO
  1301. EXEC sp_addextendedproperty
  1302. 'MS_Description', N'路由策略',
  1303. 'SCHEMA', N'dbo',
  1304. 'TABLE', N'sj_job',
  1305. 'COLUMN', N'route_key'
  1306. GO
  1307. EXEC sp_addextendedproperty
  1308. 'MS_Description', N'执行器类型',
  1309. 'SCHEMA', N'dbo',
  1310. 'TABLE', N'sj_job',
  1311. 'COLUMN', N'executor_type'
  1312. GO
  1313. EXEC sp_addextendedproperty
  1314. 'MS_Description', N'执行器名称',
  1315. 'SCHEMA', N'dbo',
  1316. 'TABLE', N'sj_job',
  1317. 'COLUMN', N'executor_info'
  1318. GO
  1319. EXEC sp_addextendedproperty
  1320. 'MS_Description', N'触发类型 1.CRON 表达式 2. 固定时间',
  1321. 'SCHEMA', N'dbo',
  1322. 'TABLE', N'sj_job',
  1323. 'COLUMN', N'trigger_type'
  1324. GO
  1325. EXEC sp_addextendedproperty
  1326. 'MS_Description', N'间隔时长',
  1327. 'SCHEMA', N'dbo',
  1328. 'TABLE', N'sj_job',
  1329. 'COLUMN', N'trigger_interval'
  1330. GO
  1331. EXEC sp_addextendedproperty
  1332. 'MS_Description', N'阻塞策略 1、丢弃 2、覆盖 3、并行',
  1333. 'SCHEMA', N'dbo',
  1334. 'TABLE', N'sj_job',
  1335. 'COLUMN', N'block_strategy'
  1336. GO
  1337. EXEC sp_addextendedproperty
  1338. 'MS_Description', N'任务执行超时时间,单位秒',
  1339. 'SCHEMA', N'dbo',
  1340. 'TABLE', N'sj_job',
  1341. 'COLUMN', N'executor_timeout'
  1342. GO
  1343. EXEC sp_addextendedproperty
  1344. 'MS_Description', N'最大重试次数',
  1345. 'SCHEMA', N'dbo',
  1346. 'TABLE', N'sj_job',
  1347. 'COLUMN', N'max_retry_times'
  1348. GO
  1349. EXEC sp_addextendedproperty
  1350. 'MS_Description', N'并行数',
  1351. 'SCHEMA', N'dbo',
  1352. 'TABLE', N'sj_job',
  1353. 'COLUMN', N'parallel_num'
  1354. GO
  1355. EXEC sp_addextendedproperty
  1356. 'MS_Description', N'重试间隔 ( s ) ',
  1357. 'SCHEMA', N'dbo',
  1358. 'TABLE', N'sj_job',
  1359. 'COLUMN', N'retry_interval'
  1360. GO
  1361. EXEC sp_addextendedproperty
  1362. 'MS_Description', N'bucket',
  1363. 'SCHEMA', N'dbo',
  1364. 'TABLE', N'sj_job',
  1365. 'COLUMN', N'bucket_index'
  1366. GO
  1367. EXEC sp_addextendedproperty
  1368. 'MS_Description', N'是否是常驻任务',
  1369. 'SCHEMA', N'dbo',
  1370. 'TABLE', N'sj_job',
  1371. 'COLUMN', N'resident'
  1372. GO
  1373. EXEC sp_addextendedproperty
  1374. 'MS_Description', N'描述',
  1375. 'SCHEMA', N'dbo',
  1376. 'TABLE', N'sj_job',
  1377. 'COLUMN', N'description'
  1378. GO
  1379. EXEC sp_addextendedproperty
  1380. 'MS_Description', N'扩展字段',
  1381. 'SCHEMA', N'dbo',
  1382. 'TABLE', N'sj_job',
  1383. 'COLUMN', N'ext_attrs'
  1384. GO
  1385. EXEC sp_addextendedproperty
  1386. 'MS_Description', N'逻辑删除 1、删除',
  1387. 'SCHEMA', N'dbo',
  1388. 'TABLE', N'sj_job',
  1389. 'COLUMN', N'deleted'
  1390. GO
  1391. EXEC sp_addextendedproperty
  1392. 'MS_Description', N'创建时间',
  1393. 'SCHEMA', N'dbo',
  1394. 'TABLE', N'sj_job',
  1395. 'COLUMN', N'create_dt'
  1396. GO
  1397. EXEC sp_addextendedproperty
  1398. 'MS_Description', N'修改时间',
  1399. 'SCHEMA', N'dbo',
  1400. 'TABLE', N'sj_job',
  1401. 'COLUMN', N'update_dt'
  1402. GO
  1403. EXEC sp_addextendedproperty
  1404. 'MS_Description', N'任务信息',
  1405. 'SCHEMA', N'dbo',
  1406. 'TABLE', N'sj_job'
  1407. GO
  1408. 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, description, ext_attrs, deleted, create_dt, update_dt) VALUES (N'dev', N'ruoyi_group', N'demo-job', null, 1, 1710344035622, 1, 1, 4, 1, N'testJobExecutor', 2, N'60', 1, 60, 3, 1, 1, 116, 0, N'', N'', 0, getdate(), getdate())
  1409. GO
  1410. -- sj_job_log_message
  1411. CREATE TABLE sj_job_log_message
  1412. (
  1413. id bigint NOT NULL PRIMARY KEY IDENTITY,
  1414. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  1415. group_name nvarchar(64) NOT NULL,
  1416. job_id bigint NOT NULL,
  1417. task_batch_id bigint NOT NULL,
  1418. task_id bigint NOT NULL,
  1419. message nvarchar(max) NOT NULL,
  1420. log_num int NOT NULL DEFAULT 1,
  1421. real_time bigint NOT NULL DEFAULT 0,
  1422. ext_attrs nvarchar(256) NULL DEFAULT '',
  1423. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  1424. )
  1425. GO
  1426. CREATE INDEX idx_sj_job_log_message_01 ON sj_job_log_message (task_batch_id, task_id)
  1427. GO
  1428. CREATE INDEX idx_sj_job_log_message_02 ON sj_job_log_message (create_dt)
  1429. GO
  1430. CREATE INDEX idx_sj_job_log_message_03 ON sj_job_log_message (namespace_id, group_name)
  1431. GO
  1432. EXEC sp_addextendedproperty
  1433. 'MS_Description', N'主键',
  1434. 'SCHEMA', N'dbo',
  1435. 'TABLE', N'sj_job_log_message',
  1436. 'COLUMN', N'id'
  1437. GO
  1438. EXEC sp_addextendedproperty
  1439. 'MS_Description', N'命名空间id',
  1440. 'SCHEMA', N'dbo',
  1441. 'TABLE', N'sj_job_log_message',
  1442. 'COLUMN', N'namespace_id'
  1443. GO
  1444. EXEC sp_addextendedproperty
  1445. 'MS_Description', N'组名称',
  1446. 'SCHEMA', N'dbo',
  1447. 'TABLE', N'sj_job_log_message',
  1448. 'COLUMN', N'group_name'
  1449. GO
  1450. EXEC sp_addextendedproperty
  1451. 'MS_Description', N'任务信息id',
  1452. 'SCHEMA', N'dbo',
  1453. 'TABLE', N'sj_job_log_message',
  1454. 'COLUMN', N'job_id'
  1455. GO
  1456. EXEC sp_addextendedproperty
  1457. 'MS_Description', N'任务批次id',
  1458. 'SCHEMA', N'dbo',
  1459. 'TABLE', N'sj_job_log_message',
  1460. 'COLUMN', N'task_batch_id'
  1461. GO
  1462. EXEC sp_addextendedproperty
  1463. 'MS_Description', N'调度任务id',
  1464. 'SCHEMA', N'dbo',
  1465. 'TABLE', N'sj_job_log_message',
  1466. 'COLUMN', N'task_id'
  1467. GO
  1468. EXEC sp_addextendedproperty
  1469. 'MS_Description', N'调度信息',
  1470. 'SCHEMA', N'dbo',
  1471. 'TABLE', N'sj_job_log_message',
  1472. 'COLUMN', N'message'
  1473. GO
  1474. EXEC sp_addextendedproperty
  1475. 'MS_Description', N'日志数量',
  1476. 'SCHEMA', N'dbo',
  1477. 'TABLE', N'sj_job_log_message',
  1478. 'COLUMN', N'log_num'
  1479. GO
  1480. EXEC sp_addextendedproperty
  1481. 'MS_Description', N'上报时间',
  1482. 'SCHEMA', N'dbo',
  1483. 'TABLE', N'sj_job_log_message',
  1484. 'COLUMN', N'real_time'
  1485. GO
  1486. EXEC sp_addextendedproperty
  1487. 'MS_Description', N'扩展字段',
  1488. 'SCHEMA', N'dbo',
  1489. 'TABLE', N'sj_job_log_message',
  1490. 'COLUMN', N'ext_attrs'
  1491. GO
  1492. EXEC sp_addextendedproperty
  1493. 'MS_Description', N'创建时间',
  1494. 'SCHEMA', N'dbo',
  1495. 'TABLE', N'sj_job_log_message',
  1496. 'COLUMN', N'create_dt'
  1497. GO
  1498. EXEC sp_addextendedproperty
  1499. 'MS_Description', N'调度日志',
  1500. 'SCHEMA', N'dbo',
  1501. 'TABLE', N'sj_job_log_message'
  1502. GO
  1503. -- sj_job_task
  1504. CREATE TABLE sj_job_task
  1505. (
  1506. id bigint NOT NULL PRIMARY KEY IDENTITY,
  1507. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  1508. group_name nvarchar(64) NOT NULL,
  1509. job_id bigint NOT NULL,
  1510. task_batch_id bigint NOT NULL,
  1511. parent_id bigint NOT NULL DEFAULT 0,
  1512. task_status tinyint NOT NULL DEFAULT 0,
  1513. retry_count int NOT NULL DEFAULT 0,
  1514. client_info nvarchar(128) NULL DEFAULT NULL,
  1515. result_message nvarchar(max) NOT NULL,
  1516. args_str nvarchar(max) NULL DEFAULT NULL,
  1517. args_type tinyint NOT NULL DEFAULT 1,
  1518. ext_attrs nvarchar(256) NULL DEFAULT '',
  1519. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  1520. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  1521. )
  1522. GO
  1523. CREATE INDEX idx_sj_job_task_01 ON sj_job_task (task_batch_id, task_status)
  1524. GO
  1525. CREATE INDEX idx_sj_job_task_02 ON sj_job_task (create_dt)
  1526. GO
  1527. CREATE INDEX idx_sj_job_task_03 ON sj_job_task (namespace_id, group_name)
  1528. GO
  1529. EXEC sp_addextendedproperty
  1530. 'MS_Description', N'主键',
  1531. 'SCHEMA', N'dbo',
  1532. 'TABLE', N'sj_job_task',
  1533. 'COLUMN', N'id'
  1534. GO
  1535. EXEC sp_addextendedproperty
  1536. 'MS_Description', N'命名空间id',
  1537. 'SCHEMA', N'dbo',
  1538. 'TABLE', N'sj_job_task',
  1539. 'COLUMN', N'namespace_id'
  1540. GO
  1541. EXEC sp_addextendedproperty
  1542. 'MS_Description', N'组名称',
  1543. 'SCHEMA', N'dbo',
  1544. 'TABLE', N'sj_job_task',
  1545. 'COLUMN', N'group_name'
  1546. GO
  1547. EXEC sp_addextendedproperty
  1548. 'MS_Description', N'任务信息id',
  1549. 'SCHEMA', N'dbo',
  1550. 'TABLE', N'sj_job_task',
  1551. 'COLUMN', N'job_id'
  1552. GO
  1553. EXEC sp_addextendedproperty
  1554. 'MS_Description', N'调度任务id',
  1555. 'SCHEMA', N'dbo',
  1556. 'TABLE', N'sj_job_task',
  1557. 'COLUMN', N'task_batch_id'
  1558. GO
  1559. EXEC sp_addextendedproperty
  1560. 'MS_Description', N'父执行器id',
  1561. 'SCHEMA', N'dbo',
  1562. 'TABLE', N'sj_job_task',
  1563. 'COLUMN', N'parent_id'
  1564. GO
  1565. EXEC sp_addextendedproperty
  1566. 'MS_Description', N'执行的状态 0、失败 1、成功',
  1567. 'SCHEMA', N'dbo',
  1568. 'TABLE', N'sj_job_task',
  1569. 'COLUMN', N'task_status'
  1570. GO
  1571. EXEC sp_addextendedproperty
  1572. 'MS_Description', N'重试次数',
  1573. 'SCHEMA', N'dbo',
  1574. 'TABLE', N'sj_job_task',
  1575. 'COLUMN', N'retry_count'
  1576. GO
  1577. EXEC sp_addextendedproperty
  1578. 'MS_Description', N'客户端地址 clientId#ip:port',
  1579. 'SCHEMA', N'dbo',
  1580. 'TABLE', N'sj_job_task',
  1581. 'COLUMN', N'client_info'
  1582. GO
  1583. EXEC sp_addextendedproperty
  1584. 'MS_Description', N'执行结果',
  1585. 'SCHEMA', N'dbo',
  1586. 'TABLE', N'sj_job_task',
  1587. 'COLUMN', N'result_message'
  1588. GO
  1589. EXEC sp_addextendedproperty
  1590. 'MS_Description', N'执行方法参数',
  1591. 'SCHEMA', N'dbo',
  1592. 'TABLE', N'sj_job_task',
  1593. 'COLUMN', N'args_str'
  1594. GO
  1595. EXEC sp_addextendedproperty
  1596. 'MS_Description', N'参数类型 ',
  1597. 'SCHEMA', N'dbo',
  1598. 'TABLE', N'sj_job_task',
  1599. 'COLUMN', N'args_type'
  1600. GO
  1601. EXEC sp_addextendedproperty
  1602. 'MS_Description', N'扩展字段',
  1603. 'SCHEMA', N'dbo',
  1604. 'TABLE', N'sj_job_task',
  1605. 'COLUMN', N'ext_attrs'
  1606. GO
  1607. EXEC sp_addextendedproperty
  1608. 'MS_Description', N'创建时间',
  1609. 'SCHEMA', N'dbo',
  1610. 'TABLE', N'sj_job_task',
  1611. 'COLUMN', N'create_dt'
  1612. GO
  1613. EXEC sp_addextendedproperty
  1614. 'MS_Description', N'修改时间',
  1615. 'SCHEMA', N'dbo',
  1616. 'TABLE', N'sj_job_task',
  1617. 'COLUMN', N'update_dt'
  1618. GO
  1619. EXEC sp_addextendedproperty
  1620. 'MS_Description', N'任务实例',
  1621. 'SCHEMA', N'dbo',
  1622. 'TABLE', N'sj_job_task'
  1623. GO
  1624. -- sj_job_task_batch
  1625. CREATE TABLE sj_job_task_batch
  1626. (
  1627. id bigint NOT NULL PRIMARY KEY IDENTITY,
  1628. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  1629. group_name nvarchar(64) NOT NULL,
  1630. job_id bigint NOT NULL,
  1631. workflow_node_id bigint NOT NULL DEFAULT 0,
  1632. parent_workflow_node_id bigint NOT NULL DEFAULT 0,
  1633. workflow_task_batch_id bigint NOT NULL DEFAULT 0,
  1634. task_batch_status tinyint NOT NULL DEFAULT 0,
  1635. operation_reason tinyint NOT NULL DEFAULT 0,
  1636. execution_at bigint NOT NULL DEFAULT 0,
  1637. system_task_type tinyint NOT NULL DEFAULT 3,
  1638. parent_id nvarchar(64) NOT NULL DEFAULT '',
  1639. ext_attrs nvarchar(256) NULL DEFAULT '',
  1640. deleted tinyint NOT NULL DEFAULT 0,
  1641. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  1642. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  1643. )
  1644. GO
  1645. CREATE INDEX idx_sj_job_task_batch_01 ON sj_job_task_batch (job_id, task_batch_status)
  1646. GO
  1647. CREATE INDEX idx_sj_job_task_batch_02 ON sj_job_task_batch (create_dt)
  1648. GO
  1649. CREATE INDEX idx_sj_job_task_batch_03 ON sj_job_task_batch (namespace_id, group_name)
  1650. GO
  1651. CREATE INDEX idx_sj_job_task_batch_04 ON sj_job_task_batch (workflow_task_batch_id, workflow_node_id)
  1652. GO
  1653. EXEC sp_addextendedproperty
  1654. 'MS_Description', N'主键',
  1655. 'SCHEMA', N'dbo',
  1656. 'TABLE', N'sj_job_task_batch',
  1657. 'COLUMN', N'id'
  1658. GO
  1659. EXEC sp_addextendedproperty
  1660. 'MS_Description', N'命名空间id',
  1661. 'SCHEMA', N'dbo',
  1662. 'TABLE', N'sj_job_task_batch',
  1663. 'COLUMN', N'namespace_id'
  1664. GO
  1665. EXEC sp_addextendedproperty
  1666. 'MS_Description', N'组名称',
  1667. 'SCHEMA', N'dbo',
  1668. 'TABLE', N'sj_job_task_batch',
  1669. 'COLUMN', N'group_name'
  1670. GO
  1671. EXEC sp_addextendedproperty
  1672. 'MS_Description', N'任务id',
  1673. 'SCHEMA', N'dbo',
  1674. 'TABLE', N'sj_job_task_batch',
  1675. 'COLUMN', N'job_id'
  1676. GO
  1677. EXEC sp_addextendedproperty
  1678. 'MS_Description', N'工作流节点id',
  1679. 'SCHEMA', N'dbo',
  1680. 'TABLE', N'sj_job_task_batch',
  1681. 'COLUMN', N'workflow_node_id'
  1682. GO
  1683. EXEC sp_addextendedproperty
  1684. 'MS_Description', N'工作流任务父批次id',
  1685. 'SCHEMA', N'dbo',
  1686. 'TABLE', N'sj_job_task_batch',
  1687. 'COLUMN', N'parent_workflow_node_id'
  1688. GO
  1689. EXEC sp_addextendedproperty
  1690. 'MS_Description', N'工作流任务批次id',
  1691. 'SCHEMA', N'dbo',
  1692. 'TABLE', N'sj_job_task_batch',
  1693. 'COLUMN', N'workflow_task_batch_id'
  1694. GO
  1695. EXEC sp_addextendedproperty
  1696. 'MS_Description', N'任务批次状态 0、失败 1、成功',
  1697. 'SCHEMA', N'dbo',
  1698. 'TABLE', N'sj_job_task_batch',
  1699. 'COLUMN', N'task_batch_status'
  1700. GO
  1701. EXEC sp_addextendedproperty
  1702. 'MS_Description', N'操作原因',
  1703. 'SCHEMA', N'dbo',
  1704. 'TABLE', N'sj_job_task_batch',
  1705. 'COLUMN', N'operation_reason'
  1706. GO
  1707. EXEC sp_addextendedproperty
  1708. 'MS_Description', N'任务执行时间',
  1709. 'SCHEMA', N'dbo',
  1710. 'TABLE', N'sj_job_task_batch',
  1711. 'COLUMN', N'execution_at'
  1712. GO
  1713. EXEC sp_addextendedproperty
  1714. 'MS_Description', N'任务类型 3、JOB任务 4、WORKFLOW任务',
  1715. 'SCHEMA', N'dbo',
  1716. 'TABLE', N'sj_job_task_batch',
  1717. 'COLUMN', N'system_task_type'
  1718. GO
  1719. EXEC sp_addextendedproperty
  1720. 'MS_Description', N'父节点',
  1721. 'SCHEMA', N'dbo',
  1722. 'TABLE', N'sj_job_task_batch',
  1723. 'COLUMN', N'parent_id'
  1724. GO
  1725. EXEC sp_addextendedproperty
  1726. 'MS_Description', N'扩展字段',
  1727. 'SCHEMA', N'dbo',
  1728. 'TABLE', N'sj_job_task_batch',
  1729. 'COLUMN', N'ext_attrs'
  1730. GO
  1731. EXEC sp_addextendedproperty
  1732. 'MS_Description', N'逻辑删除 1、删除',
  1733. 'SCHEMA', N'dbo',
  1734. 'TABLE', N'sj_job_task_batch',
  1735. 'COLUMN', N'deleted'
  1736. GO
  1737. EXEC sp_addextendedproperty
  1738. 'MS_Description', N'创建时间',
  1739. 'SCHEMA', N'dbo',
  1740. 'TABLE', N'sj_job_task_batch',
  1741. 'COLUMN', N'create_dt'
  1742. GO
  1743. EXEC sp_addextendedproperty
  1744. 'MS_Description', N'修改时间',
  1745. 'SCHEMA', N'dbo',
  1746. 'TABLE', N'sj_job_task_batch',
  1747. 'COLUMN', N'update_dt'
  1748. GO
  1749. EXEC sp_addextendedproperty
  1750. 'MS_Description', N'任务批次',
  1751. 'SCHEMA', N'dbo',
  1752. 'TABLE', N'sj_job_task_batch'
  1753. GO
  1754. -- sj_job_summary
  1755. CREATE TABLE sj_job_summary
  1756. (
  1757. id bigint NOT NULL PRIMARY KEY IDENTITY,
  1758. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  1759. group_name nvarchar(64) NOT NULL DEFAULT '',
  1760. business_id bigint NOT NULL,
  1761. system_task_type tinyint NOT NULL DEFAULT 3,
  1762. trigger_at datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  1763. success_num int NOT NULL DEFAULT 0,
  1764. fail_num int NOT NULL DEFAULT 0,
  1765. fail_reason nvarchar(512) NOT NULL DEFAULT '',
  1766. stop_num int NOT NULL DEFAULT 0,
  1767. stop_reason nvarchar(512) NOT NULL DEFAULT '',
  1768. cancel_num int NOT NULL DEFAULT 0,
  1769. cancel_reason nvarchar(512) NOT NULL DEFAULT '',
  1770. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  1771. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  1772. )
  1773. GO
  1774. CREATE UNIQUE INDEX uk_sj_job_summary_01 ON sj_job_summary (trigger_at, system_task_type, business_id)
  1775. GO
  1776. CREATE INDEX idx_sj_job_summary_01 ON sj_job_summary (namespace_id, group_name, business_id)
  1777. GO
  1778. EXEC sp_addextendedproperty
  1779. 'MS_Description', N'主键',
  1780. 'SCHEMA', N'dbo',
  1781. 'TABLE', N'sj_job_summary',
  1782. 'COLUMN', N'id'
  1783. GO
  1784. EXEC sp_addextendedproperty
  1785. 'MS_Description', N'命名空间id',
  1786. 'SCHEMA', N'dbo',
  1787. 'TABLE', N'sj_job_summary',
  1788. 'COLUMN', N'namespace_id'
  1789. GO
  1790. EXEC sp_addextendedproperty
  1791. 'MS_Description', N'组名称',
  1792. 'SCHEMA', N'dbo',
  1793. 'TABLE', N'sj_job_summary',
  1794. 'COLUMN', N'group_name'
  1795. GO
  1796. EXEC sp_addextendedproperty
  1797. 'MS_Description', N'业务id ( job_id或workflow_id ) ',
  1798. 'SCHEMA', N'dbo',
  1799. 'TABLE', N'sj_job_summary',
  1800. 'COLUMN', N'business_id'
  1801. GO
  1802. EXEC sp_addextendedproperty
  1803. 'MS_Description', N'任务类型 3、JOB任务 4、WORKFLOW任务',
  1804. 'SCHEMA', N'dbo',
  1805. 'TABLE', N'sj_job_summary',
  1806. 'COLUMN', N'system_task_type'
  1807. GO
  1808. EXEC sp_addextendedproperty
  1809. 'MS_Description', N'统计时间',
  1810. 'SCHEMA', N'dbo',
  1811. 'TABLE', N'sj_job_summary',
  1812. 'COLUMN', N'trigger_at'
  1813. GO
  1814. EXEC sp_addextendedproperty
  1815. 'MS_Description', N'执行成功-日志数量',
  1816. 'SCHEMA', N'dbo',
  1817. 'TABLE', N'sj_job_summary',
  1818. 'COLUMN', N'success_num'
  1819. GO
  1820. EXEC sp_addextendedproperty
  1821. 'MS_Description', N'执行失败-日志数量',
  1822. 'SCHEMA', N'dbo',
  1823. 'TABLE', N'sj_job_summary',
  1824. 'COLUMN', N'fail_num'
  1825. GO
  1826. EXEC sp_addextendedproperty
  1827. 'MS_Description', N'失败原因',
  1828. 'SCHEMA', N'dbo',
  1829. 'TABLE', N'sj_job_summary',
  1830. 'COLUMN', N'fail_reason'
  1831. GO
  1832. EXEC sp_addextendedproperty
  1833. 'MS_Description', N'执行失败-日志数量',
  1834. 'SCHEMA', N'dbo',
  1835. 'TABLE', N'sj_job_summary',
  1836. 'COLUMN', N'stop_num'
  1837. GO
  1838. EXEC sp_addextendedproperty
  1839. 'MS_Description', N'失败原因',
  1840. 'SCHEMA', N'dbo',
  1841. 'TABLE', N'sj_job_summary',
  1842. 'COLUMN', N'stop_reason'
  1843. GO
  1844. EXEC sp_addextendedproperty
  1845. 'MS_Description', N'执行失败-日志数量',
  1846. 'SCHEMA', N'dbo',
  1847. 'TABLE', N'sj_job_summary',
  1848. 'COLUMN', N'cancel_num'
  1849. GO
  1850. EXEC sp_addextendedproperty
  1851. 'MS_Description', N'失败原因',
  1852. 'SCHEMA', N'dbo',
  1853. 'TABLE', N'sj_job_summary',
  1854. 'COLUMN', N'cancel_reason'
  1855. GO
  1856. EXEC sp_addextendedproperty
  1857. 'MS_Description', N'创建时间',
  1858. 'SCHEMA', N'dbo',
  1859. 'TABLE', N'sj_job_summary',
  1860. 'COLUMN', N'create_dt'
  1861. GO
  1862. EXEC sp_addextendedproperty
  1863. 'MS_Description', N'修改时间',
  1864. 'SCHEMA', N'dbo',
  1865. 'TABLE', N'sj_job_summary',
  1866. 'COLUMN', N'update_dt'
  1867. GO
  1868. EXEC sp_addextendedproperty
  1869. 'MS_Description', N'DashBoard_Job',
  1870. 'SCHEMA', N'dbo',
  1871. 'TABLE', N'sj_job_summary'
  1872. GO
  1873. -- sj_retry_summary
  1874. CREATE TABLE sj_retry_summary
  1875. (
  1876. id bigint NOT NULL PRIMARY KEY IDENTITY,
  1877. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  1878. group_name nvarchar(64) NOT NULL DEFAULT '',
  1879. scene_name nvarchar(50) NOT NULL DEFAULT '',
  1880. trigger_at datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  1881. running_num int NOT NULL DEFAULT 0,
  1882. finish_num int NOT NULL DEFAULT 0,
  1883. max_count_num int NOT NULL DEFAULT 0,
  1884. suspend_num int NOT NULL DEFAULT 0,
  1885. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  1886. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  1887. )
  1888. GO
  1889. CREATE UNIQUE INDEX uk_sj_retry_summary_01 ON sj_retry_summary (namespace_id, group_name, scene_name, trigger_at)
  1890. GO
  1891. CREATE INDEX idx_sj_retry_summary_01 ON sj_retry_summary (trigger_at)
  1892. GO
  1893. EXEC sp_addextendedproperty
  1894. 'MS_Description', N'主键',
  1895. 'SCHEMA', N'dbo',
  1896. 'TABLE', N'sj_retry_summary',
  1897. 'COLUMN', N'id'
  1898. GO
  1899. EXEC sp_addextendedproperty
  1900. 'MS_Description', N'命名空间id',
  1901. 'SCHEMA', N'dbo',
  1902. 'TABLE', N'sj_retry_summary',
  1903. 'COLUMN', N'namespace_id'
  1904. GO
  1905. EXEC sp_addextendedproperty
  1906. 'MS_Description', N'组名称',
  1907. 'SCHEMA', N'dbo',
  1908. 'TABLE', N'sj_retry_summary',
  1909. 'COLUMN', N'group_name'
  1910. GO
  1911. EXEC sp_addextendedproperty
  1912. 'MS_Description', N'场景名称',
  1913. 'SCHEMA', N'dbo',
  1914. 'TABLE', N'sj_retry_summary',
  1915. 'COLUMN', N'scene_name'
  1916. GO
  1917. EXEC sp_addextendedproperty
  1918. 'MS_Description', N'统计时间',
  1919. 'SCHEMA', N'dbo',
  1920. 'TABLE', N'sj_retry_summary',
  1921. 'COLUMN', N'trigger_at'
  1922. GO
  1923. EXEC sp_addextendedproperty
  1924. 'MS_Description', N'重试中-日志数量',
  1925. 'SCHEMA', N'dbo',
  1926. 'TABLE', N'sj_retry_summary',
  1927. 'COLUMN', N'running_num'
  1928. GO
  1929. EXEC sp_addextendedproperty
  1930. 'MS_Description', N'重试完成-日志数量',
  1931. 'SCHEMA', N'dbo',
  1932. 'TABLE', N'sj_retry_summary',
  1933. 'COLUMN', N'finish_num'
  1934. GO
  1935. EXEC sp_addextendedproperty
  1936. 'MS_Description', N'重试到达最大次数-日志数量',
  1937. 'SCHEMA', N'dbo',
  1938. 'TABLE', N'sj_retry_summary',
  1939. 'COLUMN', N'max_count_num'
  1940. GO
  1941. EXEC sp_addextendedproperty
  1942. 'MS_Description', N'暂停重试-日志数量',
  1943. 'SCHEMA', N'dbo',
  1944. 'TABLE', N'sj_retry_summary',
  1945. 'COLUMN', N'suspend_num'
  1946. GO
  1947. EXEC sp_addextendedproperty
  1948. 'MS_Description', N'创建时间',
  1949. 'SCHEMA', N'dbo',
  1950. 'TABLE', N'sj_retry_summary',
  1951. 'COLUMN', N'create_dt'
  1952. GO
  1953. EXEC sp_addextendedproperty
  1954. 'MS_Description', N'修改时间',
  1955. 'SCHEMA', N'dbo',
  1956. 'TABLE', N'sj_retry_summary',
  1957. 'COLUMN', N'update_dt'
  1958. GO
  1959. EXEC sp_addextendedproperty
  1960. 'MS_Description', N'DashBoard_Retry',
  1961. 'SCHEMA', N'dbo',
  1962. 'TABLE', N'sj_retry_summary'
  1963. GO
  1964. -- sj_workflow
  1965. CREATE TABLE sj_workflow
  1966. (
  1967. id bigint NOT NULL PRIMARY KEY IDENTITY,
  1968. workflow_name nvarchar(64) NOT NULL,
  1969. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  1970. group_name nvarchar(64) NOT NULL,
  1971. workflow_status tinyint NOT NULL DEFAULT 1,
  1972. trigger_type tinyint NOT NULL,
  1973. trigger_interval nvarchar(255) NOT NULL,
  1974. next_trigger_at bigint NOT NULL,
  1975. block_strategy tinyint NOT NULL DEFAULT 1,
  1976. executor_timeout int NOT NULL DEFAULT 0,
  1977. description nvarchar(256) NOT NULL DEFAULT '',
  1978. flow_info nvarchar(max) NULL DEFAULT NULL,
  1979. bucket_index int NOT NULL DEFAULT 0,
  1980. version int NOT NULL,
  1981. ext_attrs nvarchar(256) NULL DEFAULT '',
  1982. deleted tinyint NOT NULL DEFAULT 0,
  1983. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  1984. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  1985. )
  1986. GO
  1987. CREATE INDEX idx_sj_workflow_01 ON sj_workflow (create_dt)
  1988. GO
  1989. CREATE INDEX idx_sj_workflow_02 ON sj_workflow (namespace_id, group_name)
  1990. GO
  1991. EXEC sp_addextendedproperty
  1992. 'MS_Description', N'主键',
  1993. 'SCHEMA', N'dbo',
  1994. 'TABLE', N'sj_workflow',
  1995. 'COLUMN', N'id'
  1996. GO
  1997. EXEC sp_addextendedproperty
  1998. 'MS_Description', N'工作流名称',
  1999. 'SCHEMA', N'dbo',
  2000. 'TABLE', N'sj_workflow',
  2001. 'COLUMN', N'workflow_name'
  2002. GO
  2003. EXEC sp_addextendedproperty
  2004. 'MS_Description', N'命名空间id',
  2005. 'SCHEMA', N'dbo',
  2006. 'TABLE', N'sj_workflow',
  2007. 'COLUMN', N'namespace_id'
  2008. GO
  2009. EXEC sp_addextendedproperty
  2010. 'MS_Description', N'组名称',
  2011. 'SCHEMA', N'dbo',
  2012. 'TABLE', N'sj_workflow',
  2013. 'COLUMN', N'group_name'
  2014. GO
  2015. EXEC sp_addextendedproperty
  2016. 'MS_Description', N'工作流状态 0、关闭、1、开启',
  2017. 'SCHEMA', N'dbo',
  2018. 'TABLE', N'sj_workflow',
  2019. 'COLUMN', N'workflow_status'
  2020. GO
  2021. EXEC sp_addextendedproperty
  2022. 'MS_Description', N'触发类型 1.CRON 表达式 2. 固定时间',
  2023. 'SCHEMA', N'dbo',
  2024. 'TABLE', N'sj_workflow',
  2025. 'COLUMN', N'trigger_type'
  2026. GO
  2027. EXEC sp_addextendedproperty
  2028. 'MS_Description', N'间隔时长',
  2029. 'SCHEMA', N'dbo',
  2030. 'TABLE', N'sj_workflow',
  2031. 'COLUMN', N'trigger_interval'
  2032. GO
  2033. EXEC sp_addextendedproperty
  2034. 'MS_Description', N'下次触发时间',
  2035. 'SCHEMA', N'dbo',
  2036. 'TABLE', N'sj_workflow',
  2037. 'COLUMN', N'next_trigger_at'
  2038. GO
  2039. EXEC sp_addextendedproperty
  2040. 'MS_Description', N'阻塞策略 1、丢弃 2、覆盖 3、并行',
  2041. 'SCHEMA', N'dbo',
  2042. 'TABLE', N'sj_workflow',
  2043. 'COLUMN', N'block_strategy'
  2044. GO
  2045. EXEC sp_addextendedproperty
  2046. 'MS_Description', N'任务执行超时时间,单位秒',
  2047. 'SCHEMA', N'dbo',
  2048. 'TABLE', N'sj_workflow',
  2049. 'COLUMN', N'executor_timeout'
  2050. GO
  2051. EXEC sp_addextendedproperty
  2052. 'MS_Description', N'描述',
  2053. 'SCHEMA', N'dbo',
  2054. 'TABLE', N'sj_workflow',
  2055. 'COLUMN', N'description'
  2056. GO
  2057. EXEC sp_addextendedproperty
  2058. 'MS_Description', N'流程信息',
  2059. 'SCHEMA', N'dbo',
  2060. 'TABLE', N'sj_workflow',
  2061. 'COLUMN', N'flow_info'
  2062. GO
  2063. EXEC sp_addextendedproperty
  2064. 'MS_Description', N'bucket',
  2065. 'SCHEMA', N'dbo',
  2066. 'TABLE', N'sj_workflow',
  2067. 'COLUMN', N'bucket_index'
  2068. GO
  2069. EXEC sp_addextendedproperty
  2070. 'MS_Description', N'版本号',
  2071. 'SCHEMA', N'dbo',
  2072. 'TABLE', N'sj_workflow',
  2073. 'COLUMN', N'version'
  2074. GO
  2075. EXEC sp_addextendedproperty
  2076. 'MS_Description', N'扩展字段',
  2077. 'SCHEMA', N'dbo',
  2078. 'TABLE', N'sj_workflow',
  2079. 'COLUMN', N'ext_attrs'
  2080. GO
  2081. EXEC sp_addextendedproperty
  2082. 'MS_Description', N'逻辑删除 1、删除',
  2083. 'SCHEMA', N'dbo',
  2084. 'TABLE', N'sj_workflow',
  2085. 'COLUMN', N'deleted'
  2086. GO
  2087. EXEC sp_addextendedproperty
  2088. 'MS_Description', N'创建时间',
  2089. 'SCHEMA', N'dbo',
  2090. 'TABLE', N'sj_workflow',
  2091. 'COLUMN', N'create_dt'
  2092. GO
  2093. EXEC sp_addextendedproperty
  2094. 'MS_Description', N'修改时间',
  2095. 'SCHEMA', N'dbo',
  2096. 'TABLE', N'sj_workflow',
  2097. 'COLUMN', N'update_dt'
  2098. GO
  2099. EXEC sp_addextendedproperty
  2100. 'MS_Description', N'工作流',
  2101. 'SCHEMA', N'dbo',
  2102. 'TABLE', N'sj_workflow'
  2103. GO
  2104. -- sj_workflow_node
  2105. CREATE TABLE sj_workflow_node
  2106. (
  2107. id bigint NOT NULL PRIMARY KEY IDENTITY,
  2108. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  2109. node_name nvarchar(64) NOT NULL,
  2110. group_name nvarchar(64) NOT NULL,
  2111. job_id bigint NOT NULL,
  2112. workflow_id bigint NOT NULL,
  2113. node_type tinyint NOT NULL DEFAULT 1,
  2114. expression_type tinyint NOT NULL DEFAULT 0,
  2115. fail_strategy tinyint NOT NULL DEFAULT 1,
  2116. workflow_node_status tinyint NOT NULL DEFAULT 1,
  2117. priority_level int NOT NULL DEFAULT 1,
  2118. node_info nvarchar(max) NULL DEFAULT NULL,
  2119. version int NOT NULL,
  2120. ext_attrs nvarchar(256) NULL DEFAULT '',
  2121. deleted tinyint NOT NULL DEFAULT 0,
  2122. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  2123. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  2124. )
  2125. GO
  2126. CREATE INDEX idx_sj_workflow_node_01 ON sj_workflow_node (create_dt)
  2127. GO
  2128. CREATE INDEX idx_sj_workflow_node_02 ON sj_workflow_node (namespace_id, group_name)
  2129. GO
  2130. EXEC sp_addextendedproperty
  2131. 'MS_Description', N'主键',
  2132. 'SCHEMA', N'dbo',
  2133. 'TABLE', N'sj_workflow_node',
  2134. 'COLUMN', N'id'
  2135. GO
  2136. EXEC sp_addextendedproperty
  2137. 'MS_Description', N'命名空间id',
  2138. 'SCHEMA', N'dbo',
  2139. 'TABLE', N'sj_workflow_node',
  2140. 'COLUMN', N'namespace_id'
  2141. GO
  2142. EXEC sp_addextendedproperty
  2143. 'MS_Description', N'节点名称',
  2144. 'SCHEMA', N'dbo',
  2145. 'TABLE', N'sj_workflow_node',
  2146. 'COLUMN', N'node_name'
  2147. GO
  2148. EXEC sp_addextendedproperty
  2149. 'MS_Description', N'组名称',
  2150. 'SCHEMA', N'dbo',
  2151. 'TABLE', N'sj_workflow_node',
  2152. 'COLUMN', N'group_name'
  2153. GO
  2154. EXEC sp_addextendedproperty
  2155. 'MS_Description', N'任务信息id',
  2156. 'SCHEMA', N'dbo',
  2157. 'TABLE', N'sj_workflow_node',
  2158. 'COLUMN', N'job_id'
  2159. GO
  2160. EXEC sp_addextendedproperty
  2161. 'MS_Description', N'工作流ID',
  2162. 'SCHEMA', N'dbo',
  2163. 'TABLE', N'sj_workflow_node',
  2164. 'COLUMN', N'workflow_id'
  2165. GO
  2166. EXEC sp_addextendedproperty
  2167. 'MS_Description', N'1、任务节点 2、条件节点',
  2168. 'SCHEMA', N'dbo',
  2169. 'TABLE', N'sj_workflow_node',
  2170. 'COLUMN', N'node_type'
  2171. GO
  2172. EXEC sp_addextendedproperty
  2173. 'MS_Description', N'1、SpEl、2、Aviator 3、QL',
  2174. 'SCHEMA', N'dbo',
  2175. 'TABLE', N'sj_workflow_node',
  2176. 'COLUMN', N'expression_type'
  2177. GO
  2178. EXEC sp_addextendedproperty
  2179. 'MS_Description', N'失败策略 1、跳过 2、阻塞',
  2180. 'SCHEMA', N'dbo',
  2181. 'TABLE', N'sj_workflow_node',
  2182. 'COLUMN', N'fail_strategy'
  2183. GO
  2184. EXEC sp_addextendedproperty
  2185. 'MS_Description', N'工作流节点状态 0、关闭、1、开启',
  2186. 'SCHEMA', N'dbo',
  2187. 'TABLE', N'sj_workflow_node',
  2188. 'COLUMN', N'workflow_node_status'
  2189. GO
  2190. EXEC sp_addextendedproperty
  2191. 'MS_Description', N'优先级',
  2192. 'SCHEMA', N'dbo',
  2193. 'TABLE', N'sj_workflow_node',
  2194. 'COLUMN', N'priority_level'
  2195. GO
  2196. EXEC sp_addextendedproperty
  2197. 'MS_Description', N'节点信息 ',
  2198. 'SCHEMA', N'dbo',
  2199. 'TABLE', N'sj_workflow_node',
  2200. 'COLUMN', N'node_info'
  2201. GO
  2202. EXEC sp_addextendedproperty
  2203. 'MS_Description', N'版本号',
  2204. 'SCHEMA', N'dbo',
  2205. 'TABLE', N'sj_workflow_node',
  2206. 'COLUMN', N'version'
  2207. GO
  2208. EXEC sp_addextendedproperty
  2209. 'MS_Description', N'扩展字段',
  2210. 'SCHEMA', N'dbo',
  2211. 'TABLE', N'sj_workflow_node',
  2212. 'COLUMN', N'ext_attrs'
  2213. GO
  2214. EXEC sp_addextendedproperty
  2215. 'MS_Description', N'逻辑删除 1、删除',
  2216. 'SCHEMA', N'dbo',
  2217. 'TABLE', N'sj_workflow_node',
  2218. 'COLUMN', N'deleted'
  2219. GO
  2220. EXEC sp_addextendedproperty
  2221. 'MS_Description', N'创建时间',
  2222. 'SCHEMA', N'dbo',
  2223. 'TABLE', N'sj_workflow_node',
  2224. 'COLUMN', N'create_dt'
  2225. GO
  2226. EXEC sp_addextendedproperty
  2227. 'MS_Description', N'修改时间',
  2228. 'SCHEMA', N'dbo',
  2229. 'TABLE', N'sj_workflow_node',
  2230. 'COLUMN', N'update_dt'
  2231. GO
  2232. EXEC sp_addextendedproperty
  2233. 'MS_Description', N'工作流节点',
  2234. 'SCHEMA', N'dbo',
  2235. 'TABLE', N'sj_workflow_node'
  2236. GO
  2237. -- sj_workflow_task_batch
  2238. CREATE TABLE sj_workflow_task_batch
  2239. (
  2240. id bigint NOT NULL PRIMARY KEY IDENTITY,
  2241. namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
  2242. group_name nvarchar(64) NOT NULL,
  2243. workflow_id bigint NOT NULL,
  2244. task_batch_status tinyint NOT NULL DEFAULT 0,
  2245. operation_reason tinyint NOT NULL DEFAULT 0,
  2246. flow_info nvarchar(max) NULL DEFAULT NULL,
  2247. execution_at bigint NOT NULL DEFAULT 0,
  2248. ext_attrs nvarchar(256) NULL DEFAULT '',
  2249. deleted tinyint NOT NULL DEFAULT 0,
  2250. create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
  2251. update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
  2252. )
  2253. GO
  2254. CREATE INDEX idx_sj_workflow_task_batch_01 ON sj_workflow_task_batch (workflow_id, task_batch_status)
  2255. GO
  2256. CREATE INDEX idx_sj_workflow_task_batch_02 ON sj_workflow_task_batch (create_dt)
  2257. GO
  2258. CREATE INDEX idx_sj_workflow_task_batch_03 ON sj_workflow_task_batch (namespace_id, group_name)
  2259. GO
  2260. EXEC sp_addextendedproperty
  2261. 'MS_Description', N'主键',
  2262. 'SCHEMA', N'dbo',
  2263. 'TABLE', N'sj_workflow_task_batch',
  2264. 'COLUMN', N'id'
  2265. GO
  2266. EXEC sp_addextendedproperty
  2267. 'MS_Description', N'命名空间id',
  2268. 'SCHEMA', N'dbo',
  2269. 'TABLE', N'sj_workflow_task_batch',
  2270. 'COLUMN', N'namespace_id'
  2271. GO
  2272. EXEC sp_addextendedproperty
  2273. 'MS_Description', N'组名称',
  2274. 'SCHEMA', N'dbo',
  2275. 'TABLE', N'sj_workflow_task_batch',
  2276. 'COLUMN', N'group_name'
  2277. GO
  2278. EXEC sp_addextendedproperty
  2279. 'MS_Description', N'工作流任务id',
  2280. 'SCHEMA', N'dbo',
  2281. 'TABLE', N'sj_workflow_task_batch',
  2282. 'COLUMN', N'workflow_id'
  2283. GO
  2284. EXEC sp_addextendedproperty
  2285. 'MS_Description', N'任务批次状态 0、失败 1、成功',
  2286. 'SCHEMA', N'dbo',
  2287. 'TABLE', N'sj_workflow_task_batch',
  2288. 'COLUMN', N'task_batch_status'
  2289. GO
  2290. EXEC sp_addextendedproperty
  2291. 'MS_Description', N'操作原因',
  2292. 'SCHEMA', N'dbo',
  2293. 'TABLE', N'sj_workflow_task_batch',
  2294. 'COLUMN', N'operation_reason'
  2295. GO
  2296. EXEC sp_addextendedproperty
  2297. 'MS_Description', N'流程信息',
  2298. 'SCHEMA', N'dbo',
  2299. 'TABLE', N'sj_workflow_task_batch',
  2300. 'COLUMN', N'flow_info'
  2301. GO
  2302. EXEC sp_addextendedproperty
  2303. 'MS_Description', N'任务执行时间',
  2304. 'SCHEMA', N'dbo',
  2305. 'TABLE', N'sj_workflow_task_batch',
  2306. 'COLUMN', N'execution_at'
  2307. GO
  2308. EXEC sp_addextendedproperty
  2309. 'MS_Description', N'扩展字段',
  2310. 'SCHEMA', N'dbo',
  2311. 'TABLE', N'sj_workflow_task_batch',
  2312. 'COLUMN', N'ext_attrs'
  2313. GO
  2314. EXEC sp_addextendedproperty
  2315. 'MS_Description', N'逻辑删除 1、删除',
  2316. 'SCHEMA', N'dbo',
  2317. 'TABLE', N'sj_workflow_task_batch',
  2318. 'COLUMN', N'deleted'
  2319. GO
  2320. EXEC sp_addextendedproperty
  2321. 'MS_Description', N'创建时间',
  2322. 'SCHEMA', N'dbo',
  2323. 'TABLE', N'sj_workflow_task_batch',
  2324. 'COLUMN', N'create_dt'
  2325. GO
  2326. EXEC sp_addextendedproperty
  2327. 'MS_Description', N'修改时间',
  2328. 'SCHEMA', N'dbo',
  2329. 'TABLE', N'sj_workflow_task_batch',
  2330. 'COLUMN', N'update_dt'
  2331. GO
  2332. EXEC sp_addextendedproperty
  2333. 'MS_Description', N'工作流批次',
  2334. 'SCHEMA', N'dbo',
  2335. 'TABLE', N'sj_workflow_task_batch'
  2336. GO