dolphinscheduler_postgre.sql 33 KB

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