dolphinscheduler_postgre.sql 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954
  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_code bigint NOT 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_code bigint NOT 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. warning_group_id int DEFAULT NULL ,
  273. flag int DEFAULT NULL ,
  274. timeout int DEFAULT '0' ,
  275. tenant_id int DEFAULT '-1' ,
  276. create_time timestamp DEFAULT NULL ,
  277. update_time timestamp DEFAULT NULL ,
  278. PRIMARY KEY (id) ,
  279. CONSTRAINT process_definition_unique UNIQUE (name, project_code)
  280. ) ;
  281. create index process_definition_index on t_ds_process_definition (code,id);
  282. DROP TABLE IF EXISTS t_ds_process_definition_log;
  283. CREATE TABLE t_ds_process_definition_log (
  284. id int NOT NULL ,
  285. code bigint NOT NULL,
  286. name varchar(255) DEFAULT NULL ,
  287. version int DEFAULT NULL ,
  288. description text ,
  289. project_code bigint DEFAULT NULL ,
  290. release_state int DEFAULT NULL ,
  291. user_id int DEFAULT NULL ,
  292. global_params text ,
  293. locations text ,
  294. warning_group_id int DEFAULT NULL ,
  295. flag int DEFAULT NULL ,
  296. timeout int DEFAULT '0' ,
  297. tenant_id int DEFAULT '-1' ,
  298. operator int DEFAULT NULL ,
  299. operate_time timestamp DEFAULT NULL ,
  300. create_time timestamp DEFAULT NULL ,
  301. update_time timestamp DEFAULT NULL ,
  302. PRIMARY KEY (id)
  303. ) ;
  304. DROP TABLE IF EXISTS t_ds_task_definition;
  305. CREATE TABLE t_ds_task_definition (
  306. id int NOT NULL ,
  307. code bigint NOT NULL,
  308. name varchar(255) DEFAULT NULL ,
  309. version int DEFAULT NULL ,
  310. description text ,
  311. project_code bigint DEFAULT NULL ,
  312. user_id int DEFAULT NULL ,
  313. task_type varchar(50) DEFAULT NULL ,
  314. task_params text ,
  315. flag int DEFAULT NULL ,
  316. task_priority int DEFAULT NULL ,
  317. worker_group varchar(255) DEFAULT NULL ,
  318. environment_code bigint DEFAULT NULL,
  319. fail_retry_times int DEFAULT NULL ,
  320. fail_retry_interval int DEFAULT NULL ,
  321. timeout_flag int DEFAULT NULL ,
  322. timeout_notify_strategy int DEFAULT NULL ,
  323. timeout int DEFAULT '0' ,
  324. delay_time int DEFAULT '0' ,
  325. resource_ids varchar(255) DEFAULT NULL ,
  326. create_time timestamp DEFAULT NULL ,
  327. update_time timestamp DEFAULT NULL ,
  328. PRIMARY KEY (id) ,
  329. CONSTRAINT task_definition_unique UNIQUE (name, project_code)
  330. ) ;
  331. create index task_definition_index on t_ds_task_definition (project_code,id);
  332. DROP TABLE IF EXISTS t_ds_task_definition_log;
  333. CREATE TABLE t_ds_task_definition_log (
  334. id int NOT NULL ,
  335. code bigint NOT NULL,
  336. name varchar(255) DEFAULT NULL ,
  337. version int DEFAULT NULL ,
  338. description text ,
  339. project_code bigint DEFAULT NULL ,
  340. user_id int DEFAULT NULL ,
  341. task_type varchar(50) DEFAULT NULL ,
  342. task_params text ,
  343. flag int DEFAULT NULL ,
  344. task_priority int DEFAULT NULL ,
  345. worker_group varchar(255) DEFAULT NULL ,
  346. environment_code bigint DEFAULT NULL,
  347. fail_retry_times int DEFAULT NULL ,
  348. fail_retry_interval int DEFAULT NULL ,
  349. timeout_flag int DEFAULT NULL ,
  350. timeout_notify_strategy int DEFAULT NULL ,
  351. timeout int DEFAULT '0' ,
  352. delay_time int DEFAULT '0' ,
  353. resource_ids varchar(255) DEFAULT NULL ,
  354. operator int DEFAULT NULL ,
  355. operate_time timestamp DEFAULT NULL ,
  356. create_time timestamp DEFAULT NULL ,
  357. update_time timestamp DEFAULT NULL ,
  358. PRIMARY KEY (id)
  359. ) ;
  360. DROP TABLE IF EXISTS t_ds_process_task_relation;
  361. CREATE TABLE t_ds_process_task_relation (
  362. id int NOT NULL ,
  363. name varchar(255) DEFAULT NULL ,
  364. process_definition_version int DEFAULT NULL ,
  365. project_code bigint DEFAULT NULL ,
  366. process_definition_code bigint DEFAULT NULL ,
  367. pre_task_code bigint DEFAULT NULL ,
  368. pre_task_version int DEFAULT '0' ,
  369. post_task_code bigint DEFAULT NULL ,
  370. post_task_version int DEFAULT '0' ,
  371. condition_type int DEFAULT NULL ,
  372. condition_params text ,
  373. create_time timestamp DEFAULT NULL ,
  374. update_time timestamp DEFAULT NULL ,
  375. PRIMARY KEY (id)
  376. ) ;
  377. DROP TABLE IF EXISTS t_ds_process_task_relation_log;
  378. CREATE TABLE t_ds_process_task_relation_log (
  379. id int NOT NULL ,
  380. name varchar(255) DEFAULT NULL ,
  381. process_definition_version int DEFAULT NULL ,
  382. project_code bigint DEFAULT NULL ,
  383. process_definition_code bigint DEFAULT NULL ,
  384. pre_task_code bigint DEFAULT NULL ,
  385. pre_task_version int DEFAULT '0' ,
  386. post_task_code bigint DEFAULT NULL ,
  387. post_task_version int DEFAULT '0' ,
  388. condition_type int DEFAULT NULL ,
  389. condition_params text ,
  390. operator int DEFAULT NULL ,
  391. operate_time timestamp DEFAULT NULL ,
  392. create_time timestamp DEFAULT NULL ,
  393. update_time timestamp DEFAULT NULL ,
  394. PRIMARY KEY (id)
  395. ) ;
  396. --
  397. -- Table structure for table t_ds_process_instance
  398. --
  399. DROP TABLE IF EXISTS t_ds_process_instance;
  400. CREATE TABLE t_ds_process_instance (
  401. id int NOT NULL ,
  402. name varchar(255) DEFAULT NULL ,
  403. process_definition_version int DEFAULT NULL ,
  404. process_definition_code bigint DEFAULT NULL ,
  405. state int DEFAULT NULL ,
  406. recovery int DEFAULT NULL ,
  407. start_time timestamp DEFAULT NULL ,
  408. end_time timestamp DEFAULT NULL ,
  409. run_times int DEFAULT NULL ,
  410. host varchar(135) DEFAULT NULL ,
  411. command_type int DEFAULT NULL ,
  412. command_param text ,
  413. task_depend_type int DEFAULT NULL ,
  414. max_try_times int DEFAULT '0' ,
  415. failure_strategy int DEFAULT '0' ,
  416. warning_type int DEFAULT '0' ,
  417. warning_group_id int DEFAULT NULL ,
  418. schedule_time timestamp DEFAULT NULL ,
  419. command_start_time timestamp DEFAULT NULL ,
  420. global_params text ,
  421. process_instance_json text ,
  422. flag int DEFAULT '1' ,
  423. update_time timestamp NULL ,
  424. is_sub_process int DEFAULT '0' ,
  425. executor_id int NOT NULL ,
  426. history_cmd text ,
  427. dependence_schedule_times text ,
  428. process_instance_priority int DEFAULT NULL ,
  429. worker_group varchar(64) ,
  430. environment_code bigint DEFAULT NULL,
  431. timeout int DEFAULT '0' ,
  432. tenant_id int NOT NULL DEFAULT '-1' ,
  433. var_pool text ,
  434. PRIMARY KEY (id)
  435. ) ;
  436. create index process_instance_index on t_ds_process_instance (process_definition_code,id);
  437. create index start_time_index on t_ds_process_instance (start_time);
  438. --
  439. -- Table structure for table t_ds_project
  440. --
  441. DROP TABLE IF EXISTS t_ds_project;
  442. CREATE TABLE t_ds_project (
  443. id int NOT NULL ,
  444. name varchar(100) DEFAULT NULL ,
  445. code bigint NOT NULL,
  446. description varchar(200) DEFAULT NULL ,
  447. user_id int DEFAULT NULL ,
  448. flag int DEFAULT '1' ,
  449. create_time timestamp DEFAULT CURRENT_TIMESTAMP ,
  450. update_time timestamp DEFAULT CURRENT_TIMESTAMP ,
  451. PRIMARY KEY (id)
  452. ) ;
  453. create index user_id_index on t_ds_project (user_id);
  454. --
  455. -- Table structure for table t_ds_queue
  456. --
  457. DROP TABLE IF EXISTS t_ds_queue;
  458. CREATE TABLE t_ds_queue (
  459. id int NOT NULL ,
  460. queue_name varchar(64) DEFAULT NULL ,
  461. queue varchar(64) DEFAULT NULL ,
  462. create_time timestamp DEFAULT NULL ,
  463. update_time timestamp DEFAULT NULL ,
  464. PRIMARY KEY (id)
  465. );
  466. --
  467. -- Table structure for table t_ds_relation_datasource_user
  468. --
  469. DROP TABLE IF EXISTS t_ds_relation_datasource_user;
  470. CREATE TABLE t_ds_relation_datasource_user (
  471. id int NOT NULL ,
  472. user_id int NOT NULL ,
  473. datasource_id int DEFAULT NULL ,
  474. perm int DEFAULT '1' ,
  475. create_time timestamp DEFAULT NULL ,
  476. update_time timestamp DEFAULT NULL ,
  477. PRIMARY KEY (id)
  478. ) ;
  479. ;
  480. --
  481. -- Table structure for table t_ds_relation_process_instance
  482. --
  483. DROP TABLE IF EXISTS t_ds_relation_process_instance;
  484. CREATE TABLE t_ds_relation_process_instance (
  485. id int NOT NULL ,
  486. parent_process_instance_id int DEFAULT NULL ,
  487. parent_task_instance_id int DEFAULT NULL ,
  488. process_instance_id int DEFAULT NULL ,
  489. PRIMARY KEY (id)
  490. ) ;
  491. --
  492. -- Table structure for table t_ds_relation_project_user
  493. --
  494. DROP TABLE IF EXISTS t_ds_relation_project_user;
  495. CREATE TABLE t_ds_relation_project_user (
  496. id int NOT NULL ,
  497. user_id int NOT NULL ,
  498. project_id int DEFAULT NULL ,
  499. perm int DEFAULT '1' ,
  500. create_time timestamp DEFAULT NULL ,
  501. update_time timestamp DEFAULT NULL ,
  502. PRIMARY KEY (id)
  503. ) ;
  504. create index relation_project_user_id_index on t_ds_relation_project_user (user_id);
  505. --
  506. -- Table structure for table t_ds_relation_resources_user
  507. --
  508. DROP TABLE IF EXISTS t_ds_relation_resources_user;
  509. CREATE TABLE t_ds_relation_resources_user (
  510. id int NOT NULL ,
  511. user_id int NOT NULL ,
  512. resources_id int DEFAULT NULL ,
  513. perm int DEFAULT '1' ,
  514. create_time timestamp DEFAULT NULL ,
  515. update_time timestamp DEFAULT NULL ,
  516. PRIMARY KEY (id)
  517. ) ;
  518. --
  519. -- Table structure for table t_ds_relation_udfs_user
  520. --
  521. DROP TABLE IF EXISTS t_ds_relation_udfs_user;
  522. CREATE TABLE t_ds_relation_udfs_user (
  523. id int NOT NULL ,
  524. user_id int NOT NULL ,
  525. udf_id int DEFAULT NULL ,
  526. perm int DEFAULT '1' ,
  527. create_time timestamp DEFAULT NULL ,
  528. update_time timestamp DEFAULT NULL ,
  529. PRIMARY KEY (id)
  530. ) ;
  531. ;
  532. --
  533. -- Table structure for table t_ds_resources
  534. --
  535. DROP TABLE IF EXISTS t_ds_resources;
  536. CREATE TABLE t_ds_resources (
  537. id int NOT NULL ,
  538. alias varchar(64) DEFAULT NULL ,
  539. file_name varchar(64) DEFAULT NULL ,
  540. description varchar(255) DEFAULT NULL ,
  541. user_id int DEFAULT NULL ,
  542. type int DEFAULT NULL ,
  543. size bigint DEFAULT NULL ,
  544. create_time timestamp DEFAULT NULL ,
  545. update_time timestamp DEFAULT NULL ,
  546. pid int,
  547. full_name varchar(64),
  548. is_directory int,
  549. PRIMARY KEY (id),
  550. CONSTRAINT t_ds_resources_un UNIQUE (full_name, type)
  551. ) ;
  552. --
  553. -- Table structure for table t_ds_schedules
  554. --
  555. DROP TABLE IF EXISTS t_ds_schedules;
  556. CREATE TABLE t_ds_schedules (
  557. id int NOT NULL ,
  558. process_definition_code bigint NOT NULL ,
  559. start_time timestamp NOT NULL ,
  560. end_time timestamp NOT NULL ,
  561. timezone_id varchar(40) default NULL ,
  562. crontab varchar(255) NOT NULL ,
  563. failure_strategy int NOT NULL ,
  564. user_id int NOT NULL ,
  565. release_state int NOT NULL ,
  566. warning_type int NOT NULL ,
  567. warning_group_id int DEFAULT NULL ,
  568. process_instance_priority int DEFAULT NULL ,
  569. worker_group varchar(64),
  570. environment_code bigint DEFAULT NULL,
  571. create_time timestamp NOT NULL ,
  572. update_time timestamp NOT NULL ,
  573. PRIMARY KEY (id)
  574. );
  575. --
  576. -- Table structure for table t_ds_session
  577. --
  578. DROP TABLE IF EXISTS t_ds_session;
  579. CREATE TABLE t_ds_session (
  580. id varchar(64) NOT NULL ,
  581. user_id int DEFAULT NULL ,
  582. ip varchar(45) DEFAULT NULL ,
  583. last_login_time timestamp DEFAULT NULL ,
  584. PRIMARY KEY (id)
  585. );
  586. --
  587. -- Table structure for table t_ds_task_instance
  588. --
  589. DROP TABLE IF EXISTS t_ds_task_instance;
  590. CREATE TABLE t_ds_task_instance (
  591. id int NOT NULL ,
  592. name varchar(255) DEFAULT NULL ,
  593. task_type varchar(50) DEFAULT NULL ,
  594. task_code bigint NOT NULL,
  595. task_definition_version int DEFAULT NULL ,
  596. process_instance_id int DEFAULT NULL ,
  597. state int DEFAULT NULL ,
  598. submit_time timestamp DEFAULT NULL ,
  599. start_time timestamp DEFAULT NULL ,
  600. end_time timestamp DEFAULT NULL ,
  601. host varchar(135) DEFAULT NULL ,
  602. execute_path varchar(200) DEFAULT NULL ,
  603. log_path varchar(200) DEFAULT NULL ,
  604. alert_flag int DEFAULT NULL ,
  605. retry_times int DEFAULT '0' ,
  606. pid int DEFAULT NULL ,
  607. app_link text ,
  608. task_params text ,
  609. flag int DEFAULT '1' ,
  610. retry_interval int DEFAULT NULL ,
  611. max_retry_times int DEFAULT NULL ,
  612. task_instance_priority int DEFAULT NULL ,
  613. worker_group varchar(64),
  614. environment_code bigint DEFAULT NULL,
  615. environment_config text DEFAULT '',
  616. executor_id int DEFAULT NULL ,
  617. first_submit_time timestamp DEFAULT NULL ,
  618. delay_time int DEFAULT '0' ,
  619. var_pool text ,
  620. PRIMARY KEY (id),
  621. CONSTRAINT foreign_key_instance_id FOREIGN KEY(process_instance_id) REFERENCES t_ds_process_instance(id) ON DELETE CASCADE
  622. ) ;
  623. --
  624. -- Table structure for table t_ds_tenant
  625. --
  626. DROP TABLE IF EXISTS t_ds_tenant;
  627. CREATE TABLE t_ds_tenant (
  628. id int NOT NULL ,
  629. tenant_code varchar(64) DEFAULT NULL ,
  630. description varchar(255) DEFAULT NULL ,
  631. queue_id int DEFAULT NULL ,
  632. create_time timestamp DEFAULT NULL ,
  633. update_time timestamp DEFAULT NULL ,
  634. PRIMARY KEY (id)
  635. ) ;
  636. --
  637. -- Table structure for table t_ds_udfs
  638. --
  639. DROP TABLE IF EXISTS t_ds_udfs;
  640. CREATE TABLE t_ds_udfs (
  641. id int NOT NULL ,
  642. user_id int NOT NULL ,
  643. func_name varchar(100) NOT NULL ,
  644. class_name varchar(255) NOT NULL ,
  645. type int NOT NULL ,
  646. arg_types varchar(255) DEFAULT NULL ,
  647. database varchar(255) DEFAULT NULL ,
  648. description varchar(255) DEFAULT NULL ,
  649. resource_id int NOT NULL ,
  650. resource_name varchar(255) NOT NULL ,
  651. create_time timestamp NOT NULL ,
  652. update_time timestamp NOT NULL ,
  653. PRIMARY KEY (id)
  654. ) ;
  655. --
  656. -- Table structure for table t_ds_user
  657. --
  658. DROP TABLE IF EXISTS t_ds_user;
  659. CREATE TABLE t_ds_user (
  660. id int NOT NULL ,
  661. user_name varchar(64) DEFAULT NULL ,
  662. user_password varchar(64) DEFAULT NULL ,
  663. user_type int DEFAULT NULL ,
  664. email varchar(64) DEFAULT NULL ,
  665. phone varchar(11) DEFAULT NULL ,
  666. tenant_id int DEFAULT NULL ,
  667. create_time timestamp DEFAULT NULL ,
  668. update_time timestamp DEFAULT NULL ,
  669. queue varchar(64) DEFAULT NULL ,
  670. state int DEFAULT 1 ,
  671. PRIMARY KEY (id)
  672. );
  673. comment on column t_ds_user.state is 'state 0:disable 1:enable';
  674. --
  675. -- Table structure for table t_ds_version
  676. --
  677. DROP TABLE IF EXISTS t_ds_version;
  678. CREATE TABLE t_ds_version (
  679. id int NOT NULL ,
  680. version varchar(200) NOT NULL,
  681. PRIMARY KEY (id)
  682. ) ;
  683. create index version_index on t_ds_version(version);
  684. --
  685. -- Table structure for table t_ds_worker_group
  686. --
  687. DROP TABLE IF EXISTS t_ds_worker_group;
  688. CREATE TABLE t_ds_worker_group (
  689. id bigint NOT NULL ,
  690. name varchar(255) NOT NULL ,
  691. addr_list text DEFAULT NULL ,
  692. create_time timestamp DEFAULT NULL ,
  693. update_time timestamp DEFAULT NULL ,
  694. PRIMARY KEY (id) ,
  695. CONSTRAINT name_unique UNIQUE (name)
  696. ) ;
  697. --
  698. -- Table structure for table t_ds_worker_server
  699. --
  700. DROP TABLE IF EXISTS t_ds_worker_server;
  701. CREATE TABLE t_ds_worker_server (
  702. id int NOT NULL ,
  703. host varchar(45) DEFAULT NULL ,
  704. port int DEFAULT NULL ,
  705. zk_directory varchar(64) DEFAULT NULL ,
  706. res_info varchar(255) DEFAULT NULL ,
  707. create_time timestamp DEFAULT NULL ,
  708. last_heartbeat_time timestamp DEFAULT NULL ,
  709. PRIMARY KEY (id)
  710. ) ;
  711. DROP SEQUENCE IF EXISTS t_ds_access_token_id_sequence;
  712. CREATE SEQUENCE t_ds_access_token_id_sequence;
  713. ALTER TABLE t_ds_access_token ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_access_token_id_sequence');
  714. DROP SEQUENCE IF EXISTS t_ds_alert_id_sequence;
  715. CREATE SEQUENCE t_ds_alert_id_sequence;
  716. ALTER TABLE t_ds_alert ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_alert_id_sequence');
  717. DROP SEQUENCE IF EXISTS t_ds_alertgroup_id_sequence;
  718. CREATE SEQUENCE t_ds_alertgroup_id_sequence;
  719. ALTER TABLE t_ds_alertgroup ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_alertgroup_id_sequence');
  720. DROP SEQUENCE IF EXISTS t_ds_command_id_sequence;
  721. CREATE SEQUENCE t_ds_command_id_sequence;
  722. ALTER TABLE t_ds_command ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_command_id_sequence');
  723. DROP SEQUENCE IF EXISTS t_ds_datasource_id_sequence;
  724. CREATE SEQUENCE t_ds_datasource_id_sequence;
  725. ALTER TABLE t_ds_datasource ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_datasource_id_sequence');
  726. DROP SEQUENCE IF EXISTS t_ds_process_definition_id_sequence;
  727. CREATE SEQUENCE t_ds_process_definition_id_sequence;
  728. ALTER TABLE t_ds_process_definition ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_definition_id_sequence');
  729. DROP SEQUENCE IF EXISTS t_ds_process_definition_log_id_sequence;
  730. CREATE SEQUENCE t_ds_process_definition_log_id_sequence;
  731. ALTER TABLE t_ds_process_definition_log ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_definition_log_id_sequence');
  732. DROP SEQUENCE IF EXISTS t_ds_task_definition_id_sequence;
  733. CREATE SEQUENCE t_ds_task_definition_id_sequence;
  734. ALTER TABLE t_ds_task_definition ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_task_definition_id_sequence');
  735. DROP SEQUENCE IF EXISTS t_ds_task_definition_log_id_sequence;
  736. CREATE SEQUENCE t_ds_task_definition_log_id_sequence;
  737. ALTER TABLE t_ds_task_definition_log ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_task_definition_log_id_sequence');
  738. DROP SEQUENCE IF EXISTS t_ds_process_task_relation_id_sequence;
  739. CREATE SEQUENCE t_ds_process_task_relation_id_sequence;
  740. ALTER TABLE t_ds_process_task_relation ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_task_relation_id_sequence');
  741. DROP SEQUENCE IF EXISTS t_ds_process_task_relation_log_id_sequence;
  742. CREATE SEQUENCE t_ds_process_task_relation_log_id_sequence;
  743. ALTER TABLE t_ds_process_task_relation_log ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_task_relation_log_id_sequence');
  744. DROP SEQUENCE IF EXISTS t_ds_process_instance_id_sequence;
  745. CREATE SEQUENCE t_ds_process_instance_id_sequence;
  746. ALTER TABLE t_ds_process_instance ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_instance_id_sequence');
  747. DROP SEQUENCE IF EXISTS t_ds_project_id_sequence;
  748. CREATE SEQUENCE t_ds_project_id_sequence;
  749. ALTER TABLE t_ds_project ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_project_id_sequence');
  750. DROP SEQUENCE IF EXISTS t_ds_queue_id_sequence;
  751. CREATE SEQUENCE t_ds_queue_id_sequence;
  752. ALTER TABLE t_ds_queue ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_queue_id_sequence');
  753. DROP SEQUENCE IF EXISTS t_ds_relation_datasource_user_id_sequence;
  754. CREATE SEQUENCE t_ds_relation_datasource_user_id_sequence;
  755. ALTER TABLE t_ds_relation_datasource_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_datasource_user_id_sequence');
  756. DROP SEQUENCE IF EXISTS t_ds_relation_process_instance_id_sequence;
  757. CREATE SEQUENCE t_ds_relation_process_instance_id_sequence;
  758. ALTER TABLE t_ds_relation_process_instance ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_process_instance_id_sequence');
  759. DROP SEQUENCE IF EXISTS t_ds_relation_project_user_id_sequence;
  760. CREATE SEQUENCE t_ds_relation_project_user_id_sequence;
  761. ALTER TABLE t_ds_relation_project_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_project_user_id_sequence');
  762. DROP SEQUENCE IF EXISTS t_ds_relation_resources_user_id_sequence;
  763. CREATE SEQUENCE t_ds_relation_resources_user_id_sequence;
  764. ALTER TABLE t_ds_relation_resources_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_resources_user_id_sequence');
  765. DROP SEQUENCE IF EXISTS t_ds_relation_udfs_user_id_sequence;
  766. CREATE SEQUENCE t_ds_relation_udfs_user_id_sequence;
  767. ALTER TABLE t_ds_relation_udfs_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_udfs_user_id_sequence');
  768. DROP SEQUENCE IF EXISTS t_ds_resources_id_sequence;
  769. CREATE SEQUENCE t_ds_resources_id_sequence;
  770. ALTER TABLE t_ds_resources ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_resources_id_sequence');
  771. DROP SEQUENCE IF EXISTS t_ds_schedules_id_sequence;
  772. CREATE SEQUENCE t_ds_schedules_id_sequence;
  773. ALTER TABLE t_ds_schedules ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_schedules_id_sequence');
  774. DROP SEQUENCE IF EXISTS t_ds_task_instance_id_sequence;
  775. CREATE SEQUENCE t_ds_task_instance_id_sequence;
  776. ALTER TABLE t_ds_task_instance ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_task_instance_id_sequence');
  777. DROP SEQUENCE IF EXISTS t_ds_tenant_id_sequence;
  778. CREATE SEQUENCE t_ds_tenant_id_sequence;
  779. ALTER TABLE t_ds_tenant ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_tenant_id_sequence');
  780. DROP SEQUENCE IF EXISTS t_ds_udfs_id_sequence;
  781. CREATE SEQUENCE t_ds_udfs_id_sequence;
  782. ALTER TABLE t_ds_udfs ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_udfs_id_sequence');
  783. DROP SEQUENCE IF EXISTS t_ds_user_id_sequence;
  784. CREATE SEQUENCE t_ds_user_id_sequence;
  785. ALTER TABLE t_ds_user ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_user_id_sequence');
  786. DROP SEQUENCE IF EXISTS t_ds_version_id_sequence;
  787. CREATE SEQUENCE t_ds_version_id_sequence;
  788. ALTER TABLE t_ds_version ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_version_id_sequence');
  789. DROP SEQUENCE IF EXISTS t_ds_worker_group_id_sequence;
  790. CREATE SEQUENCE t_ds_worker_group_id_sequence;
  791. ALTER TABLE t_ds_worker_group ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_worker_group_id_sequence');
  792. DROP SEQUENCE IF EXISTS t_ds_worker_server_id_sequence;
  793. CREATE SEQUENCE t_ds_worker_server_id_sequence;
  794. ALTER TABLE t_ds_worker_server ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_worker_server_id_sequence');
  795. -- Records of t_ds_user?user : admin , password : dolphinscheduler123
  796. INSERT INTO t_ds_user(user_name, user_password, user_type, email, phone, tenant_id, state, create_time, update_time)
  797. VALUES ('admin', '7ad2410b2f4c074479a8937a28a22b8f', '0', 'xxx@qq.com', '', '0', 1, '2018-03-27 15:48:50', '2018-10-24 17:40:22');
  798. -- Records of t_ds_alertgroup, default admin warning group
  799. INSERT INTO t_ds_alertgroup(alert_instance_ids, create_user_id, group_name, description, create_time, update_time)
  800. VALUES ('1,2', 1, 'default admin warning group', 'default admin warning group', '2018-11-29 10:20:39', '2018-11-29 10:20:39');
  801. -- Records of t_ds_queue,default queue name : default
  802. INSERT INTO t_ds_queue(queue_name, queue, create_time, update_time)
  803. VALUES ('default', 'default', '2018-11-29 10:22:33', '2018-11-29 10:22:33');
  804. -- Records of t_ds_queue,default queue name : default
  805. INSERT INTO t_ds_version(version) VALUES ('1.4.0');
  806. --
  807. -- Table structure for table t_ds_plugin_define
  808. --
  809. DROP TABLE IF EXISTS t_ds_plugin_define;
  810. CREATE TABLE t_ds_plugin_define (
  811. id serial NOT NULL,
  812. plugin_name varchar(100) NOT NULL,
  813. plugin_type varchar(100) NOT NULL,
  814. plugin_params text NULL,
  815. create_time timestamp NULL,
  816. update_time timestamp NULL,
  817. CONSTRAINT t_ds_plugin_define_pk PRIMARY KEY (id),
  818. CONSTRAINT t_ds_plugin_define_un UNIQUE (plugin_name, plugin_type)
  819. );
  820. --
  821. -- Table structure for table t_ds_alert_plugin_instance
  822. --
  823. DROP TABLE IF EXISTS t_ds_alert_plugin_instance;
  824. CREATE TABLE t_ds_alert_plugin_instance (
  825. id serial NOT NULL,
  826. plugin_define_id int4 NOT NULL,
  827. plugin_instance_params text NULL,
  828. create_time timestamp NULL,
  829. update_time timestamp NULL,
  830. instance_name varchar(200) NULL,
  831. CONSTRAINT t_ds_alert_plugin_instance_pk PRIMARY KEY (id)
  832. );
  833. --
  834. -- Table structure for table t_ds_environment
  835. --
  836. DROP TABLE IF EXISTS t_ds_environment;
  837. CREATE TABLE t_ds_environment (
  838. id serial NOT NULL,
  839. code bigint NOT NULL,
  840. name varchar(100) DEFAULT NULL,
  841. config text DEFAULT NULL,
  842. description text,
  843. operator int DEFAULT NULL,
  844. create_time timestamp DEFAULT NULL,
  845. update_time timestamp DEFAULT NULL,
  846. PRIMARY KEY (id),
  847. CONSTRAINT environment_name_unique UNIQUE (name),
  848. CONSTRAINT environment_code_unique UNIQUE (code)
  849. );
  850. --
  851. -- Table structure for table t_ds_environment_worker_group_relation
  852. --
  853. DROP TABLE IF EXISTS t_ds_environment_worker_group_relation;
  854. CREATE TABLE t_ds_environment_worker_group_relation (
  855. id serial NOT NULL,
  856. environment_code bigint NOT NULL,
  857. worker_group varchar(255) NOT NULL,
  858. operator int DEFAULT NULL,
  859. create_time timestamp DEFAULT NULL,
  860. update_time timestamp DEFAULT NULL,
  861. PRIMARY KEY (id) ,
  862. CONSTRAINT environment_worker_group_unique UNIQUE (environment_code,worker_group)
  863. );