Переглянути джерело

to issue/#8826 (#8827)

Co-authored-by: ouyangyewei <yewei.oyyw@alibaba-inc.com>
ouyangyewei 3 роки тому
батько
коміт
b0ffec5a4c

+ 2 - 1
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql

@@ -285,7 +285,8 @@ CREATE TABLE `t_ds_alert` (
   `alertgroup_id` int(11) DEFAULT NULL COMMENT 'alert group id',
   `create_time` datetime DEFAULT NULL COMMENT 'create time',
   `update_time` datetime DEFAULT NULL COMMENT 'update time',
-  PRIMARY KEY (`id`)
+  PRIMARY KEY (`id`),
+  KEY `idx_status` (`alert_status`) USING BTREE
 ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
 
 -- ----------------------------

+ 2 - 0
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql

@@ -217,6 +217,8 @@ CREATE TABLE t_ds_alert (
   PRIMARY KEY (id)
 ) ;
 
+create index idx_status on t_ds_alert (alert_status);
+
 --
 -- Table structure for table t_ds_alertgroup
 --

+ 2 - 0
dolphinscheduler-dao/src/main/resources/sql/upgrade/2.1.0_schema/mysql/dolphinscheduler_ddl.sql

@@ -31,6 +31,8 @@ alter table t_ds_task_definition add `task_group_priority` int(11) DEFAULT '0' C
 
 ALTER TABLE `t_ds_user` ADD COLUMN `time_zone` varchar(32) DEFAULT NULL COMMENT 'time zone';
 
+ALTER TABLE `t_ds_alert` ADD INDEX `idx_status` (`alert_status`) USING BTREE;
+
 --
 -- Table structure for table `t_ds_dq_comparison_type`
 --

+ 3 - 0
dolphinscheduler-dao/src/main/resources/sql/upgrade/2.1.0_schema/postgresql/dolphinscheduler_ddl.sql

@@ -156,6 +156,9 @@ EXECUTE 'CREATE TABLE IF NOT EXISTS' || quote_ident(v_schema) ||'."t_ds_relation
     CONSTRAINT t_ds_relation_rule_input_entry_pk PRIMARY KEY (id)
 )';
 
+EXECUTE 'DROP INDEX IF EXISTS "idx_alert_status"';
+EXECUTE 'CREATE INDEX IF NOT EXISTS idx_alert_status ON ' || quote_ident(v_schema) ||'.t_ds_alert USING Btree("alert_status")';
+
 EXECUTE 'DROP INDEX IF EXISTS "idx_task_definition_log_project_code"';
 EXECUTE 'CREATE INDEX IF NOT EXISTS idx_task_definition_log_project_code ON ' || quote_ident(v_schema) ||'.t_ds_task_definition_log USING Btree("project_code")';