dolphinscheduler_postgre.sql 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS;
  18. DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS;
  19. DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE;
  20. DROP TABLE IF EXISTS QRTZ_LOCKS;
  21. DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS;
  22. DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS;
  23. DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS;
  24. DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS;
  25. DROP TABLE IF EXISTS QRTZ_TRIGGERS;
  26. DROP TABLE IF EXISTS QRTZ_JOB_DETAILS;
  27. DROP TABLE IF EXISTS QRTZ_CALENDARS;
  28. CREATE TABLE QRTZ_JOB_DETAILS(
  29. SCHED_NAME character varying(120) NOT NULL,
  30. JOB_NAME character varying(200) NOT NULL,
  31. JOB_GROUP character varying(200) NOT NULL,
  32. DESCRIPTION character varying(250) NULL,
  33. JOB_CLASS_NAME character varying(250) NOT NULL,
  34. IS_DURABLE boolean NOT NULL,
  35. IS_NONCONCURRENT boolean NOT NULL,
  36. IS_UPDATE_DATA boolean NOT NULL,
  37. REQUESTS_RECOVERY boolean NOT NULL,
  38. JOB_DATA bytea NULL);
  39. alter table QRTZ_JOB_DETAILS add primary key(SCHED_NAME,JOB_NAME,JOB_GROUP);
  40. CREATE TABLE QRTZ_TRIGGERS (
  41. SCHED_NAME character varying(120) NOT NULL,
  42. TRIGGER_NAME character varying(200) NOT NULL,
  43. TRIGGER_GROUP character varying(200) NOT NULL,
  44. JOB_NAME character varying(200) NOT NULL,
  45. JOB_GROUP character varying(200) NOT NULL,
  46. DESCRIPTION character varying(250) NULL,
  47. NEXT_FIRE_TIME BIGINT NULL,
  48. PREV_FIRE_TIME BIGINT NULL,
  49. PRIORITY INTEGER NULL,
  50. TRIGGER_STATE character varying(16) NOT NULL,
  51. TRIGGER_TYPE character varying(8) NOT NULL,
  52. START_TIME BIGINT NOT NULL,
  53. END_TIME BIGINT NULL,
  54. CALENDAR_NAME character varying(200) NULL,
  55. MISFIRE_INSTR SMALLINT NULL,
  56. JOB_DATA bytea NULL) ;
  57. alter table QRTZ_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
  58. CREATE TABLE QRTZ_SIMPLE_TRIGGERS (
  59. SCHED_NAME character varying(120) NOT NULL,
  60. TRIGGER_NAME character varying(200) NOT NULL,
  61. TRIGGER_GROUP character varying(200) NOT NULL,
  62. REPEAT_COUNT BIGINT NOT NULL,
  63. REPEAT_INTERVAL BIGINT NOT NULL,
  64. TIMES_TRIGGERED BIGINT NOT NULL) ;
  65. alter table QRTZ_SIMPLE_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
  66. CREATE TABLE QRTZ_CRON_TRIGGERS (
  67. SCHED_NAME character varying(120) NOT NULL,
  68. TRIGGER_NAME character varying(200) NOT NULL,
  69. TRIGGER_GROUP character varying(200) NOT NULL,
  70. CRON_EXPRESSION character varying(120) NOT NULL,
  71. TIME_ZONE_ID character varying(80)) ;
  72. alter table QRTZ_CRON_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
  73. CREATE TABLE QRTZ_SIMPROP_TRIGGERS
  74. (
  75. SCHED_NAME character varying(120) NOT NULL,
  76. TRIGGER_NAME character varying(200) NOT NULL,
  77. TRIGGER_GROUP character varying(200) NOT NULL,
  78. STR_PROP_1 character varying(512) NULL,
  79. STR_PROP_2 character varying(512) NULL,
  80. STR_PROP_3 character varying(512) NULL,
  81. INT_PROP_1 INT NULL,
  82. INT_PROP_2 INT NULL,
  83. LONG_PROP_1 BIGINT NULL,
  84. LONG_PROP_2 BIGINT NULL,
  85. DEC_PROP_1 NUMERIC(13,4) NULL,
  86. DEC_PROP_2 NUMERIC(13,4) NULL,
  87. BOOL_PROP_1 boolean NULL,
  88. BOOL_PROP_2 boolean NULL) ;
  89. alter table QRTZ_SIMPROP_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
  90. CREATE TABLE QRTZ_BLOB_TRIGGERS (
  91. SCHED_NAME character varying(120) NOT NULL,
  92. TRIGGER_NAME character varying(200) NOT NULL,
  93. TRIGGER_GROUP character varying(200) NOT NULL,
  94. BLOB_DATA bytea NULL) ;
  95. alter table QRTZ_BLOB_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
  96. CREATE TABLE QRTZ_CALENDARS (
  97. SCHED_NAME character varying(120) NOT NULL,
  98. CALENDAR_NAME character varying(200) NOT NULL,
  99. CALENDAR bytea NOT NULL) ;
  100. alter table QRTZ_CALENDARS add primary key(SCHED_NAME,CALENDAR_NAME);
  101. CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS (
  102. SCHED_NAME character varying(120) NOT NULL,
  103. TRIGGER_GROUP character varying(200) NOT NULL) ;
  104. alter table QRTZ_PAUSED_TRIGGER_GRPS add primary key(SCHED_NAME,TRIGGER_GROUP);
  105. CREATE TABLE QRTZ_FIRED_TRIGGERS (
  106. SCHED_NAME character varying(120) NOT NULL,
  107. ENTRY_ID character varying(200) NOT NULL,
  108. TRIGGER_NAME character varying(200) NOT NULL,
  109. TRIGGER_GROUP character varying(200) NOT NULL,
  110. INSTANCE_NAME character varying(200) NOT NULL,
  111. FIRED_TIME BIGINT NOT NULL,
  112. SCHED_TIME BIGINT NOT NULL,
  113. PRIORITY INTEGER NOT NULL,
  114. STATE character varying(16) NOT NULL,
  115. JOB_NAME character varying(200) NULL,
  116. JOB_GROUP character varying(200) NULL,
  117. IS_NONCONCURRENT boolean NULL,
  118. REQUESTS_RECOVERY boolean NULL) ;
  119. alter table QRTZ_FIRED_TRIGGERS add primary key(SCHED_NAME,ENTRY_ID);
  120. CREATE TABLE QRTZ_SCHEDULER_STATE (
  121. SCHED_NAME character varying(120) NOT NULL,
  122. INSTANCE_NAME character varying(200) NOT NULL,
  123. LAST_CHECKIN_TIME BIGINT NOT NULL,
  124. CHECKIN_INTERVAL BIGINT NOT NULL) ;
  125. alter table QRTZ_SCHEDULER_STATE add primary key(SCHED_NAME,INSTANCE_NAME);
  126. CREATE TABLE QRTZ_LOCKS (
  127. SCHED_NAME character varying(120) NOT NULL,
  128. LOCK_NAME character varying(40) NOT NULL) ;
  129. alter table QRTZ_LOCKS add primary key(SCHED_NAME,LOCK_NAME);
  130. CREATE INDEX IDX_QRTZ_J_REQ_RECOVERY ON QRTZ_JOB_DETAILS(SCHED_NAME,REQUESTS_RECOVERY);
  131. CREATE INDEX IDX_QRTZ_J_GRP ON QRTZ_JOB_DETAILS(SCHED_NAME,JOB_GROUP);
  132. CREATE INDEX IDX_QRTZ_T_J ON QRTZ_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP);
  133. CREATE INDEX IDX_QRTZ_T_JG ON QRTZ_TRIGGERS(SCHED_NAME,JOB_GROUP);
  134. CREATE INDEX IDX_QRTZ_T_C ON QRTZ_TRIGGERS(SCHED_NAME,CALENDAR_NAME);
  135. CREATE INDEX IDX_QRTZ_T_G ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP);
  136. CREATE INDEX IDX_QRTZ_T_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE);
  137. CREATE INDEX IDX_QRTZ_T_N_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE);
  138. CREATE INDEX IDX_QRTZ_T_N_G_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE);
  139. CREATE INDEX IDX_QRTZ_T_NEXT_FIRE_TIME ON QRTZ_TRIGGERS(SCHED_NAME,NEXT_FIRE_TIME);
  140. CREATE INDEX IDX_QRTZ_T_NFT_ST ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME);
  141. CREATE INDEX IDX_QRTZ_T_NFT_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME);
  142. CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE);
  143. CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE_GRP ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE);
  144. CREATE INDEX IDX_QRTZ_FT_TRIG_INST_NAME ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME);
  145. CREATE INDEX IDX_QRTZ_FT_INST_JOB_REQ_RCVRY ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY);
  146. CREATE INDEX IDX_QRTZ_FT_J_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP);
  147. CREATE INDEX IDX_QRTZ_FT_JG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_GROUP);
  148. CREATE INDEX IDX_QRTZ_FT_T_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
  149. CREATE INDEX IDX_QRTZ_FT_TG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP);
  150. --
  151. -- Table structure for table t_ds_access_token
  152. --
  153. DROP TABLE IF EXISTS t_ds_access_token;
  154. CREATE TABLE t_ds_access_token (
  155. id int NOT NULL ,
  156. user_id int DEFAULT NULL ,
  157. token varchar(64) DEFAULT NULL ,
  158. expire_time timestamp DEFAULT NULL ,
  159. create_time timestamp DEFAULT NULL ,
  160. update_time timestamp DEFAULT NULL ,
  161. PRIMARY KEY (id)
  162. ) ;
  163. --
  164. -- Table structure for table t_ds_alert
  165. --
  166. DROP TABLE IF EXISTS t_ds_alert;
  167. CREATE TABLE t_ds_alert (
  168. id int NOT NULL ,
  169. title varchar(64) DEFAULT NULL ,
  170. content text ,
  171. alert_status int DEFAULT '0' ,
  172. log text ,
  173. alertgroup_id int DEFAULT NULL ,
  174. create_time timestamp DEFAULT NULL ,
  175. update_time timestamp DEFAULT NULL ,
  176. PRIMARY KEY (id)
  177. ) ;
  178. --
  179. -- Table structure for table t_ds_alertgroup
  180. --
  181. DROP TABLE IF EXISTS t_ds_alertgroup;
  182. CREATE TABLE t_ds_alertgroup(
  183. id int NOT NULL,
  184. alert_instance_ids varchar (255) DEFAULT NULL,
  185. create_user_id int4 DEFAULT NULL,
  186. group_name varchar(255) DEFAULT NULL,
  187. description varchar(255) DEFAULT NULL,
  188. create_time timestamp DEFAULT NULL,
  189. update_time timestamp DEFAULT NULL,
  190. PRIMARY KEY (id),
  191. CONSTRAINT t_ds_alertgroup_name_un UNIQUE (group_name)
  192. ) ;
  193. --
  194. -- Table structure for table t_ds_command
  195. --
  196. DROP TABLE IF EXISTS t_ds_command;
  197. CREATE TABLE t_ds_command (
  198. id int NOT NULL ,
  199. command_type int DEFAULT NULL ,
  200. process_definition_id int DEFAULT NULL ,
  201. command_param text ,
  202. task_depend_type int DEFAULT NULL ,
  203. failure_strategy int DEFAULT '0' ,
  204. warning_type int DEFAULT '0' ,
  205. warning_group_id int DEFAULT NULL ,
  206. schedule_time timestamp DEFAULT NULL ,
  207. start_time timestamp DEFAULT NULL ,
  208. executor_id int DEFAULT NULL ,
  209. update_time timestamp DEFAULT NULL ,
  210. process_instance_priority int DEFAULT NULL ,
  211. worker_group varchar(64),
  212. environment_code bigint DEFAULT NULL,
  213. PRIMARY KEY (id)
  214. ) ;
  215. --
  216. -- Table structure for table t_ds_datasource
  217. --
  218. DROP TABLE IF EXISTS t_ds_datasource;
  219. CREATE TABLE t_ds_datasource (
  220. id int NOT NULL ,
  221. name varchar(64) NOT NULL ,
  222. note varchar(255) DEFAULT NULL ,
  223. type int NOT NULL ,
  224. user_id int NOT NULL ,
  225. connection_params text NOT NULL ,
  226. create_time timestamp NOT NULL ,
  227. update_time timestamp DEFAULT NULL ,
  228. PRIMARY KEY (id),
  229. CONSTRAINT t_ds_datasource_name_un UNIQUE (name, type)
  230. ) ;
  231. --
  232. -- Table structure for table t_ds_error_command
  233. --
  234. DROP TABLE IF EXISTS t_ds_error_command;
  235. CREATE TABLE t_ds_error_command (
  236. id int NOT NULL ,
  237. command_type int DEFAULT NULL ,
  238. executor_id int DEFAULT NULL ,
  239. process_definition_id int DEFAULT NULL ,
  240. command_param text ,
  241. task_depend_type int DEFAULT NULL ,
  242. failure_strategy int DEFAULT '0' ,
  243. warning_type int DEFAULT '0' ,
  244. warning_group_id int DEFAULT NULL ,
  245. schedule_time timestamp DEFAULT NULL ,
  246. start_time timestamp DEFAULT NULL ,
  247. update_time timestamp DEFAULT NULL ,
  248. process_instance_priority int DEFAULT NULL ,
  249. worker_group varchar(64),
  250. environment_code bigint DEFAULT NULL,
  251. message text ,
  252. PRIMARY KEY (id)
  253. );
  254. --
  255. -- Table structure for table t_ds_master_server
  256. --
  257. --
  258. -- Table structure for table t_ds_process_definition
  259. --
  260. DROP TABLE IF EXISTS t_ds_process_definition;
  261. CREATE TABLE t_ds_process_definition (
  262. id int NOT NULL ,
  263. code bigint NOT NULL,
  264. name varchar(255) DEFAULT NULL ,
  265. version int DEFAULT NULL ,
  266. description text ,
  267. project_code bigint DEFAULT NULL ,
  268. release_state int DEFAULT NULL ,
  269. user_id int DEFAULT NULL ,
  270. global_params text ,
  271. locations text ,
  272. connects text ,
  273. warning_group_id int DEFAULT NULL ,
  274. flag int DEFAULT NULL ,
  275. timeout int DEFAULT '0' ,
  276. tenant_id int DEFAULT '-1' ,
  277. create_time timestamp DEFAULT NULL ,
  278. update_time timestamp DEFAULT NULL ,
  279. PRIMARY KEY (id) ,
  280. CONSTRAINT process_definition_unique UNIQUE (name, project_code) ,
  281. CONSTRAINT code_unique UNIQUE (code)
  282. ) ;
  283. create index process_definition_index on t_ds_process_definition (code,id);
  284. DROP TABLE IF EXISTS t_ds_process_definition_log;
  285. CREATE TABLE t_ds_process_definition_log (
  286. id int NOT NULL ,
  287. code bigint NOT NULL,
  288. name varchar(255) DEFAULT NULL ,
  289. version int DEFAULT NULL ,
  290. description text ,
  291. project_code bigint DEFAULT NULL ,
  292. release_state int DEFAULT NULL ,
  293. user_id int DEFAULT NULL ,
  294. global_params text ,
  295. locations text ,
  296. connects text ,
  297. warning_group_id int DEFAULT NULL ,
  298. flag int DEFAULT NULL ,
  299. timeout int DEFAULT '0' ,
  300. tenant_id int DEFAULT '-1' ,
  301. operator int DEFAULT NULL ,
  302. operate_time timestamp DEFAULT NULL ,
  303. create_time timestamp DEFAULT NULL ,
  304. update_time timestamp DEFAULT NULL ,
  305. PRIMARY KEY (id)
  306. ) ;
  307. DROP TABLE IF EXISTS t_ds_task_definition;
  308. CREATE TABLE t_ds_task_definition (
  309. id int NOT NULL ,
  310. code bigint NOT NULL,
  311. name varchar(255) DEFAULT NULL ,
  312. version int DEFAULT NULL ,
  313. description text ,
  314. project_code bigint DEFAULT NULL ,
  315. user_id int DEFAULT NULL ,
  316. task_type varchar(50) DEFAULT NULL ,
  317. task_params text ,
  318. flag int DEFAULT NULL ,
  319. task_priority int DEFAULT NULL ,
  320. worker_group varchar(255) DEFAULT NULL ,
  321. environment_code bigint DEFAULT NULL,
  322. fail_retry_times int DEFAULT NULL ,
  323. fail_retry_interval int DEFAULT NULL ,
  324. timeout_flag int DEFAULT NULL ,
  325. timeout_notify_strategy int DEFAULT NULL ,
  326. timeout int DEFAULT '0' ,
  327. delay_time int DEFAULT '0' ,
  328. resource_ids varchar(255) DEFAULT NULL ,
  329. create_time timestamp DEFAULT NULL ,
  330. update_time timestamp DEFAULT NULL ,
  331. PRIMARY KEY (id) ,
  332. CONSTRAINT task_definition_unique UNIQUE (name, project_code)
  333. ) ;
  334. create index task_definition_index on t_ds_task_definition (project_code,id);
  335. DROP TABLE IF EXISTS t_ds_task_definition_log;
  336. CREATE TABLE t_ds_task_definition_log (
  337. id int NOT NULL ,
  338. code bigint NOT NULL,
  339. name varchar(255) DEFAULT NULL ,
  340. version int DEFAULT NULL ,
  341. description text ,
  342. project_code bigint DEFAULT NULL ,
  343. user_id int DEFAULT NULL ,
  344. task_type varchar(50) DEFAULT NULL ,
  345. task_params text ,
  346. flag int DEFAULT NULL ,
  347. task_priority int DEFAULT NULL ,
  348. worker_group varchar(255) DEFAULT NULL ,
  349. environment_code bigint DEFAULT NULL,
  350. fail_retry_times int DEFAULT NULL ,
  351. fail_retry_interval int DEFAULT NULL ,
  352. timeout_flag int DEFAULT NULL ,
  353. timeout_notify_strategy int DEFAULT NULL ,
  354. timeout int DEFAULT '0' ,
  355. delay_time int DEFAULT '0' ,
  356. resource_ids varchar(255) DEFAULT NULL ,
  357. operator int DEFAULT NULL ,
  358. operate_time timestamp DEFAULT NULL ,
  359. create_time timestamp DEFAULT NULL ,
  360. update_time timestamp DEFAULT NULL ,
  361. PRIMARY KEY (id)
  362. ) ;
  363. DROP TABLE IF EXISTS t_ds_process_task_relation;
  364. CREATE TABLE t_ds_process_task_relation (
  365. id int NOT NULL ,
  366. name varchar(255) DEFAULT NULL ,
  367. process_definition_version int DEFAULT NULL ,
  368. project_code bigint DEFAULT NULL ,
  369. process_definition_code bigint DEFAULT NULL ,
  370. pre_task_code bigint DEFAULT NULL ,
  371. pre_task_version int DEFAULT '0' ,
  372. post_task_code bigint DEFAULT NULL ,
  373. post_task_version int DEFAULT '0' ,
  374. condition_type int DEFAULT NULL ,
  375. condition_params text ,
  376. create_time timestamp DEFAULT NULL ,
  377. update_time timestamp DEFAULT NULL ,
  378. PRIMARY KEY (id)
  379. ) ;
  380. DROP TABLE IF EXISTS t_ds_process_task_relation_log;
  381. CREATE TABLE t_ds_process_task_relation_log (
  382. id int NOT NULL ,
  383. name varchar(255) DEFAULT NULL ,
  384. process_definition_version int DEFAULT NULL ,
  385. project_code bigint DEFAULT NULL ,
  386. process_definition_code bigint DEFAULT NULL ,
  387. pre_task_code bigint DEFAULT NULL ,
  388. pre_task_version int DEFAULT '0' ,
  389. post_task_code bigint DEFAULT NULL ,
  390. post_task_version int DEFAULT '0' ,
  391. condition_type int DEFAULT NULL ,
  392. condition_params text ,
  393. operator int DEFAULT NULL ,
  394. operate_time timestamp DEFAULT NULL ,
  395. create_time timestamp DEFAULT NULL ,
  396. update_time timestamp DEFAULT NULL ,
  397. PRIMARY KEY (id)
  398. ) ;
  399. --
  400. -- Table structure for table t_ds_process_instance
  401. --
  402. DROP TABLE IF EXISTS t_ds_process_instance;
  403. CREATE TABLE t_ds_process_instance (
  404. id int NOT NULL ,
  405. name varchar(255) DEFAULT NULL ,
  406. process_definition_version int DEFAULT NULL ,
  407. process_definition_code bigint DEFAULT NULL ,
  408. state int DEFAULT NULL ,
  409. recovery int DEFAULT NULL ,
  410. start_time timestamp DEFAULT NULL ,
  411. end_time timestamp DEFAULT NULL ,
  412. run_times int DEFAULT NULL ,
  413. host varchar(135) DEFAULT NULL ,
  414. command_type int DEFAULT NULL ,
  415. command_param text ,
  416. task_depend_type int DEFAULT NULL ,
  417. max_try_times int DEFAULT '0' ,
  418. failure_strategy int DEFAULT '0' ,
  419. warning_type int DEFAULT '0' ,
  420. warning_group_id int DEFAULT NULL ,
  421. schedule_time timestamp DEFAULT NULL ,
  422. command_start_time timestamp DEFAULT NULL ,
  423. global_params text ,
  424. process_instance_json text ,
  425. flag int DEFAULT '1' ,
  426. update_time timestamp NULL ,
  427. is_sub_process int DEFAULT '0' ,
  428. executor_id int NOT NULL ,
  429. history_cmd text ,
  430. dependence_schedule_times text ,
  431. process_instance_priority int DEFAULT NULL ,
  432. worker_group varchar(64) ,
  433. environment_code bigint DEFAULT NULL,
  434. timeout int DEFAULT '0' ,
  435. tenant_id int NOT NULL DEFAULT '-1' ,
  436. var_pool text ,
  437. PRIMARY KEY (id)
  438. ) ;
  439. create index process_instance_index on t_ds_process_instance (process_definition_code,id);
  440. create index start_time_index on t_ds_process_instance (start_time);
  441. --
  442. -- Table structure for table t_ds_project
  443. --
  444. DROP TABLE IF EXISTS t_ds_project;
  445. CREATE TABLE t_ds_project (
  446. id int NOT NULL ,
  447. name varchar(100) DEFAULT NULL ,
  448. code bigint NOT NULL,
  449. description varchar(200) DEFAULT NULL ,
  450. user_id int DEFAULT NULL ,
  451. flag int DEFAULT '1' ,
  452. create_time timestamp DEFAULT CURRENT_TIMESTAMP ,
  453. update_time timestamp DEFAULT CURRENT_TIMESTAMP ,
  454. PRIMARY KEY (id)
  455. ) ;
  456. create index user_id_index on t_ds_project (user_id);
  457. --
  458. -- Table structure for table t_ds_queue
  459. --
  460. DROP TABLE IF EXISTS t_ds_queue;
  461. CREATE TABLE t_ds_queue (
  462. id int NOT NULL ,
  463. queue_name varchar(64) DEFAULT NULL ,
  464. queue varchar(64) DEFAULT NULL ,
  465. create_time timestamp DEFAULT NULL ,
  466. update_time timestamp DEFAULT NULL ,
  467. PRIMARY KEY (id)
  468. );
  469. --
  470. -- Table structure for table t_ds_relation_datasource_user
  471. --
  472. DROP TABLE IF EXISTS t_ds_relation_datasource_user;
  473. CREATE TABLE t_ds_relation_datasource_user (
  474. id int NOT NULL ,
  475. user_id int NOT NULL ,
  476. datasource_id int DEFAULT NULL ,
  477. perm int DEFAULT '1' ,
  478. create_time timestamp DEFAULT NULL ,
  479. update_time timestamp DEFAULT NULL ,
  480. PRIMARY KEY (id)
  481. ) ;
  482. ;
  483. --
  484. -- Table structure for table t_ds_relation_process_instance
  485. --
  486. DROP TABLE IF EXISTS t_ds_relation_process_instance;
  487. CREATE TABLE t_ds_relation_process_instance (
  488. id int NOT NULL ,
  489. parent_process_instance_id int DEFAULT NULL ,
  490. parent_task_instance_id int DEFAULT NULL ,
  491. process_instance_id int DEFAULT NULL ,
  492. PRIMARY KEY (id)
  493. ) ;
  494. --
  495. -- Table structure for table t_ds_relation_project_user
  496. --
  497. DROP TABLE IF EXISTS t_ds_relation_project_user;
  498. CREATE TABLE t_ds_relation_project_user (
  499. id int NOT NULL ,
  500. user_id int NOT NULL ,
  501. project_id int DEFAULT NULL ,
  502. perm int DEFAULT '1' ,
  503. create_time timestamp DEFAULT NULL ,
  504. update_time timestamp DEFAULT NULL ,
  505. PRIMARY KEY (id)
  506. ) ;
  507. create index relation_project_user_id_index on t_ds_relation_project_user (user_id);
  508. --
  509. -- Table structure for table t_ds_relation_resources_user
  510. --
  511. DROP TABLE IF EXISTS t_ds_relation_resources_user;
  512. CREATE TABLE t_ds_relation_resources_user (
  513. id int NOT NULL ,
  514. user_id int NOT NULL ,
  515. resources_id int DEFAULT NULL ,
  516. perm int DEFAULT '1' ,
  517. create_time timestamp DEFAULT NULL ,
  518. update_time timestamp DEFAULT NULL ,
  519. PRIMARY KEY (id)
  520. ) ;
  521. --
  522. -- Table structure for table t_ds_relation_udfs_user
  523. --
  524. DROP TABLE IF EXISTS t_ds_relation_udfs_user;
  525. CREATE TABLE t_ds_relation_udfs_user (
  526. id int NOT NULL ,
  527. user_id int NOT NULL ,
  528. udf_id int DEFAULT NULL ,
  529. perm int DEFAULT '1' ,
  530. create_time timestamp DEFAULT NULL ,
  531. update_time timestamp DEFAULT NULL ,
  532. PRIMARY KEY (id)
  533. ) ;
  534. ;
  535. --
  536. -- Table structure for table t_ds_resources
  537. --
  538. DROP TABLE IF EXISTS t_ds_resources;
  539. CREATE TABLE t_ds_resources (
  540. id int NOT NULL ,
  541. alias varchar(64) DEFAULT NULL ,
  542. file_name varchar(64) DEFAULT NULL ,
  543. description varchar(255) DEFAULT NULL ,
  544. user_id int DEFAULT NULL ,
  545. type int DEFAULT NULL ,
  546. size bigint DEFAULT NULL ,
  547. create_time timestamp DEFAULT NULL ,
  548. update_time timestamp DEFAULT NULL ,
  549. pid int,
  550. full_name varchar(64),
  551. is_directory int,
  552. PRIMARY KEY (id),
  553. CONSTRAINT t_ds_resources_un UNIQUE (full_name, type)
  554. ) ;
  555. --
  556. -- Table structure for table t_ds_schedules
  557. --
  558. DROP TABLE IF EXISTS t_ds_schedules;
  559. CREATE TABLE t_ds_schedules (
  560. id int NOT NULL ,
  561. process_definition_id int NOT NULL ,
  562. start_time timestamp NOT NULL ,
  563. end_time timestamp NOT NULL ,
  564. timezone_id varchar(40) default NULL ,
  565. crontab varchar(255) NOT NULL ,
  566. failure_strategy int NOT NULL ,
  567. user_id int NOT NULL ,
  568. release_state int NOT NULL ,
  569. warning_type int NOT NULL ,
  570. warning_group_id int DEFAULT NULL ,
  571. process_instance_priority int DEFAULT NULL ,
  572. worker_group varchar(64),
  573. environment_code bigint DEFAULT NULL,
  574. create_time timestamp NOT NULL ,
  575. update_time timestamp NOT NULL ,
  576. PRIMARY KEY (id)
  577. );
  578. --
  579. -- Table structure for table t_ds_session
  580. --
  581. DROP TABLE IF EXISTS t_ds_session;
  582. CREATE TABLE t_ds_session (
  583. id varchar(64) NOT NULL ,
  584. user_id int DEFAULT NULL ,
  585. ip varchar(45) DEFAULT NULL ,
  586. last_login_time timestamp DEFAULT NULL ,
  587. PRIMARY KEY (id)
  588. );
  589. --
  590. -- Table structure for table t_ds_task_instance
  591. --
  592. DROP TABLE IF EXISTS t_ds_task_instance;
  593. CREATE TABLE t_ds_task_instance (
  594. id int NOT NULL ,
  595. name varchar(255) DEFAULT NULL ,
  596. task_type varchar(50) DEFAULT NULL ,
  597. task_code bigint NOT NULL,
  598. task_definition_version int DEFAULT NULL ,
  599. process_instance_id int DEFAULT NULL ,
  600. state int DEFAULT NULL ,
  601. submit_time timestamp DEFAULT NULL ,
  602. start_time timestamp DEFAULT NULL ,
  603. end_time timestamp DEFAULT NULL ,
  604. host varchar(135) DEFAULT NULL ,
  605. execute_path varchar(200) DEFAULT NULL ,
  606. log_path varchar(200) DEFAULT NULL ,
  607. alert_flag int DEFAULT NULL ,
  608. retry_times int DEFAULT '0' ,
  609. pid int DEFAULT NULL ,
  610. app_link text ,
  611. task_params text ,
  612. flag int DEFAULT '1' ,
  613. retry_interval int DEFAULT NULL ,
  614. max_retry_times int DEFAULT NULL ,
  615. task_instance_priority int DEFAULT NULL ,
  616. worker_group varchar(64),
  617. environment_code bigint DEFAULT NULL,
  618. environment_config text DEFAULT '',
  619. executor_id int DEFAULT NULL ,
  620. first_submit_time timestamp DEFAULT NULL ,
  621. delay_time int DEFAULT '0' ,
  622. var_pool text ,
  623. PRIMARY KEY (id),
  624. CONSTRAINT foreign_key_instance_id FOREIGN KEY(process_instance_id) REFERENCES t_ds_process_instance(id) ON DELETE CASCADE
  625. ) ;
  626. --
  627. -- Table structure for table t_ds_tenant
  628. --
  629. DROP TABLE IF EXISTS t_ds_tenant;
  630. CREATE TABLE t_ds_tenant (
  631. id int NOT NULL ,
  632. tenant_code varchar(64) DEFAULT NULL ,
  633. description varchar(255) DEFAULT NULL ,
  634. queue_id int DEFAULT NULL ,
  635. create_time timestamp DEFAULT NULL ,
  636. update_time timestamp DEFAULT NULL ,
  637. PRIMARY KEY (id)
  638. ) ;
  639. --
  640. -- Table structure for table t_ds_udfs
  641. --
  642. DROP TABLE IF EXISTS t_ds_udfs;
  643. CREATE TABLE t_ds_udfs (
  644. id int NOT NULL ,
  645. user_id int NOT NULL ,
  646. func_name varchar(100) NOT NULL ,
  647. class_name varchar(255) NOT NULL ,
  648. type int NOT NULL ,
  649. arg_types varchar(255) DEFAULT NULL ,
  650. database varchar(255) DEFAULT NULL ,
  651. description varchar(255) DEFAULT NULL ,
  652. resource_id int NOT NULL ,
  653. resource_name varchar(255) NOT NULL ,
  654. create_time timestamp NOT NULL ,
  655. update_time timestamp NOT NULL ,
  656. PRIMARY KEY (id)
  657. ) ;
  658. --
  659. -- Table structure for table t_ds_user
  660. --
  661. DROP TABLE IF EXISTS t_ds_user;
  662. CREATE TABLE t_ds_user (
  663. id int NOT NULL ,
  664. user_name varchar(64) DEFAULT NULL ,
  665. user_password varchar(64) DEFAULT NULL ,
  666. user_type int DEFAULT NULL ,
  667. email varchar(64) DEFAULT NULL ,
  668. phone varchar(11) DEFAULT NULL ,
  669. tenant_id int DEFAULT NULL ,
  670. create_time timestamp DEFAULT NULL ,
  671. update_time timestamp DEFAULT NULL ,
  672. queue varchar(64) DEFAULT NULL ,
  673. state int DEFAULT 1 ,
  674. PRIMARY KEY (id)
  675. );
  676. comment on column t_ds_user.state is 'state 0:disable 1:enable';
  677. --
  678. -- Table structure for table t_ds_version
  679. --
  680. DROP TABLE IF EXISTS t_ds_version;
  681. CREATE TABLE t_ds_version (
  682. id int NOT NULL ,
  683. version varchar(200) NOT NULL,
  684. PRIMARY KEY (id)
  685. ) ;
  686. create index version_index on t_ds_version(version);
  687. --
  688. -- Table structure for table t_ds_worker_group
  689. --
  690. DROP TABLE IF EXISTS t_ds_worker_group;
  691. CREATE TABLE t_ds_worker_group (
  692. id bigint NOT NULL ,
  693. name varchar(255) NOT NULL ,
  694. addr_list text DEFAULT NULL ,
  695. create_time timestamp DEFAULT NULL ,
  696. update_time timestamp DEFAULT NULL ,
  697. PRIMARY KEY (id) ,
  698. CONSTRAINT name_unique UNIQUE (name)
  699. ) ;
  700. --
  701. -- Table structure for table t_ds_worker_server
  702. --
  703. DROP TABLE IF EXISTS t_ds_worker_server;
  704. CREATE TABLE t_ds_worker_server (
  705. id int NOT NULL ,
  706. host varchar(45) DEFAULT NULL ,
  707. port int DEFAULT NULL ,
  708. zk_directory varchar(64) DEFAULT NULL ,
  709. res_info varchar(255) DEFAULT NULL ,
  710. create_time timestamp DEFAULT NULL ,
  711. last_heartbeat_time timestamp DEFAULT NULL ,
  712. PRIMARY KEY (id)
  713. ) ;
  714. DROP SEQUENCE IF EXISTS t_ds_access_token_id_sequence;
  715. CREATE SEQUENCE t_ds_access_token_id_sequence;
  716. ALTER TABLE t_ds_access_token ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_access_token_id_sequence');
  717. DROP SEQUENCE IF EXISTS t_ds_alert_id_sequence;
  718. CREATE SEQUENCE t_ds_alert_id_sequence;
  719. ALTER TABLE t_ds_alert ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_alert_id_sequence');
  720. DROP SEQUENCE IF EXISTS t_ds_alertgroup_id_sequence;
  721. CREATE SEQUENCE t_ds_alertgroup_id_sequence;
  722. ALTER TABLE t_ds_alertgroup ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_alertgroup_id_sequence');
  723. DROP SEQUENCE IF EXISTS t_ds_command_id_sequence;
  724. CREATE SEQUENCE t_ds_command_id_sequence;
  725. ALTER TABLE t_ds_command ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_command_id_sequence');
  726. DROP SEQUENCE IF EXISTS t_ds_datasource_id_sequence;
  727. CREATE SEQUENCE t_ds_datasource_id_sequence;
  728. ALTER TABLE t_ds_datasource ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_datasource_id_sequence');
  729. DROP SEQUENCE IF EXISTS t_ds_process_definition_id_sequence;
  730. CREATE SEQUENCE t_ds_process_definition_id_sequence;
  731. ALTER TABLE t_ds_process_definition ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_definition_id_sequence');
  732. DROP SEQUENCE IF EXISTS t_ds_process_definition_log_id_sequence;
  733. CREATE SEQUENCE t_ds_process_definition_log_id_sequence;
  734. ALTER TABLE t_ds_process_definition_log ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_definition_log_id_sequence');
  735. DROP SEQUENCE IF EXISTS t_ds_task_definition_id_sequence;
  736. CREATE SEQUENCE t_ds_task_definition_id_sequence;
  737. ALTER TABLE t_ds_task_definition ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_task_definition_id_sequence');
  738. DROP SEQUENCE IF EXISTS t_ds_task_definition_log_id_sequence;
  739. CREATE SEQUENCE t_ds_task_definition_log_id_sequence;
  740. ALTER TABLE t_ds_task_definition_log ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_task_definition_log_id_sequence');
  741. DROP SEQUENCE IF EXISTS t_ds_process_task_relation_id_sequence;
  742. CREATE SEQUENCE t_ds_process_task_relation_id_sequence;
  743. ALTER TABLE t_ds_process_task_relation ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_task_relation_id_sequence');
  744. DROP SEQUENCE IF EXISTS t_ds_process_task_relation_log_id_sequence;
  745. CREATE SEQUENCE t_ds_process_task_relation_log_id_sequence;
  746. ALTER TABLE t_ds_process_task_relation_log ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_task_relation_log_id_sequence');
  747. DROP SEQUENCE IF EXISTS t_ds_process_instance_id_sequence;
  748. CREATE SEQUENCE t_ds_process_instance_id_sequence;
  749. ALTER TABLE t_ds_process_instance ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_instance_id_sequence');
  750. DROP SEQUENCE IF EXISTS t_ds_project_id_sequence;
  751. CREATE SEQUENCE t_ds_project_id_sequence;
  752. ALTER TABLE t_ds_project ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_project_id_sequence');
  753. DROP SEQUENCE IF EXISTS t_ds_queue_id_sequence;
  754. CREATE SEQUENCE t_ds_queue_id_sequence;
  755. ALTER TABLE t_ds_queue ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_queue_id_sequence');
  756. DROP SEQUENCE IF EXISTS t_ds_relation_datasource_user_id_sequence;
  757. CREATE SEQUENCE t_ds_relation_datasource_user_id_sequence;
  758. ALTER TABLE t_ds_relation_datasource_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_datasource_user_id_sequence');
  759. DROP SEQUENCE IF EXISTS t_ds_relation_process_instance_id_sequence;
  760. CREATE SEQUENCE t_ds_relation_process_instance_id_sequence;
  761. ALTER TABLE t_ds_relation_process_instance ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_process_instance_id_sequence');
  762. DROP SEQUENCE IF EXISTS t_ds_relation_project_user_id_sequence;
  763. CREATE SEQUENCE t_ds_relation_project_user_id_sequence;
  764. ALTER TABLE t_ds_relation_project_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_project_user_id_sequence');
  765. DROP SEQUENCE IF EXISTS t_ds_relation_resources_user_id_sequence;
  766. CREATE SEQUENCE t_ds_relation_resources_user_id_sequence;
  767. ALTER TABLE t_ds_relation_resources_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_resources_user_id_sequence');
  768. DROP SEQUENCE IF EXISTS t_ds_relation_udfs_user_id_sequence;
  769. CREATE SEQUENCE t_ds_relation_udfs_user_id_sequence;
  770. ALTER TABLE t_ds_relation_udfs_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_udfs_user_id_sequence');
  771. DROP SEQUENCE IF EXISTS t_ds_resources_id_sequence;
  772. CREATE SEQUENCE t_ds_resources_id_sequence;
  773. ALTER TABLE t_ds_resources ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_resources_id_sequence');
  774. DROP SEQUENCE IF EXISTS t_ds_schedules_id_sequence;
  775. CREATE SEQUENCE t_ds_schedules_id_sequence;
  776. ALTER TABLE t_ds_schedules ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_schedules_id_sequence');
  777. DROP SEQUENCE IF EXISTS t_ds_task_instance_id_sequence;
  778. CREATE SEQUENCE t_ds_task_instance_id_sequence;
  779. ALTER TABLE t_ds_task_instance ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_task_instance_id_sequence');
  780. DROP SEQUENCE IF EXISTS t_ds_tenant_id_sequence;
  781. CREATE SEQUENCE t_ds_tenant_id_sequence;
  782. ALTER TABLE t_ds_tenant ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_tenant_id_sequence');
  783. DROP SEQUENCE IF EXISTS t_ds_udfs_id_sequence;
  784. CREATE SEQUENCE t_ds_udfs_id_sequence;
  785. ALTER TABLE t_ds_udfs ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_udfs_id_sequence');
  786. DROP SEQUENCE IF EXISTS t_ds_user_id_sequence;
  787. CREATE SEQUENCE t_ds_user_id_sequence;
  788. ALTER TABLE t_ds_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_user_id_sequence');
  789. DROP SEQUENCE IF EXISTS t_ds_version_id_sequence;
  790. CREATE SEQUENCE t_ds_version_id_sequence;
  791. ALTER TABLE t_ds_version ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_version_id_sequence');
  792. DROP SEQUENCE IF EXISTS t_ds_worker_group_id_sequence;
  793. CREATE SEQUENCE t_ds_worker_group_id_sequence;
  794. ALTER TABLE t_ds_worker_group ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_worker_group_id_sequence');
  795. DROP SEQUENCE IF EXISTS t_ds_worker_server_id_sequence;
  796. CREATE SEQUENCE t_ds_worker_server_id_sequence;
  797. ALTER TABLE t_ds_worker_server ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_worker_server_id_sequence');
  798. -- Records of t_ds_user?user : admin , password : dolphinscheduler123
  799. INSERT INTO t_ds_user(user_name, user_password, user_type, email, phone, tenant_id, state, create_time, update_time)
  800. VALUES ('admin', '7ad2410b2f4c074479a8937a28a22b8f', '0', 'xxx@qq.com', '', '0', 1, '2018-03-27 15:48:50', '2018-10-24 17:40:22');
  801. -- Records of t_ds_alertgroup, default admin warning group
  802. INSERT INTO t_ds_alertgroup(alert_instance_ids, create_user_id, group_name, description, create_time, update_time)
  803. VALUES ('1,2', 1, 'default admin warning group', 'default admin warning group', '2018-11-29 10:20:39', '2018-11-29 10:20:39');
  804. -- Records of t_ds_queue,default queue name : default
  805. INSERT INTO t_ds_queue(queue_name, queue, create_time, update_time)
  806. VALUES ('default', 'default', '2018-11-29 10:22:33', '2018-11-29 10:22:33');
  807. -- Records of t_ds_queue,default queue name : default
  808. INSERT INTO t_ds_version(version) VALUES ('1.4.0');
  809. --
  810. -- Table structure for table t_ds_plugin_define
  811. --
  812. DROP TABLE IF EXISTS t_ds_plugin_define;
  813. CREATE TABLE t_ds_plugin_define (
  814. id serial NOT NULL,
  815. plugin_name varchar(100) NOT NULL,
  816. plugin_type varchar(100) NOT NULL,
  817. plugin_params text NULL,
  818. create_time timestamp NULL,
  819. update_time timestamp NULL,
  820. CONSTRAINT t_ds_plugin_define_pk PRIMARY KEY (id),
  821. CONSTRAINT t_ds_plugin_define_un UNIQUE (plugin_name, plugin_type)
  822. );
  823. --
  824. -- Table structure for table t_ds_alert_plugin_instance
  825. --
  826. DROP TABLE IF EXISTS t_ds_alert_plugin_instance;
  827. CREATE TABLE t_ds_alert_plugin_instance (
  828. id serial NOT NULL,
  829. plugin_define_id int4 NOT NULL,
  830. plugin_instance_params text NULL,
  831. create_time timestamp NULL,
  832. update_time timestamp NULL,
  833. instance_name varchar(200) NULL,
  834. CONSTRAINT t_ds_alert_plugin_instance_pk PRIMARY KEY (id)
  835. );
  836. --
  837. -- Table structure for table t_ds_environment
  838. --
  839. DROP TABLE IF EXISTS t_ds_environment;
  840. CREATE TABLE t_ds_environment (
  841. id serial NOT NULL,
  842. code bigint NOT NULL,
  843. name varchar(100) DEFAULT NULL,
  844. config text DEFAULT NULL,
  845. description text,
  846. operator int DEFAULT NULL,
  847. create_time timestamp DEFAULT NULL,
  848. update_time timestamp DEFAULT NULL,
  849. PRIMARY KEY (id),
  850. CONSTRAINT environment_name_unique UNIQUE (name),
  851. CONSTRAINT environment_code_unique UNIQUE (code)
  852. );
  853. --
  854. -- Table structure for table t_ds_environment_worker_group_relation
  855. --
  856. DROP TABLE IF EXISTS t_ds_environment_worker_group_relation;
  857. CREATE TABLE t_ds_environment_worker_group_relation (
  858. id serial NOT NULL,
  859. environment_code bigint NOT NULL,
  860. worker_group varchar(255) NOT NULL,
  861. operator int DEFAULT NULL,
  862. create_time timestamp DEFAULT NULL,
  863. update_time timestamp DEFAULT NULL,
  864. PRIMARY KEY (id) ,
  865. CONSTRAINT environment_worker_group_unique UNIQUE (environment_code,worker_group)
  866. );