mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-04 21:28:00 +08:00
[Fix-5904][upgrade]fix dev branch upgrade mysql sql script error (#5821)
* fix dev branch upgrade mysql sql script error. * Update naming convention.
This commit is contained in:
parent
8db1b042b2
commit
0075523fdd
@ -305,7 +305,7 @@ CREATE TABLE `t_ds_alertgroup`(
|
||||
`create_time` datetime DEFAULT NULL COMMENT 'create time',
|
||||
`update_time` datetime DEFAULT NULL COMMENT 'update time',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `t_ds_alertgroup_name_UN` (`group_name`)
|
||||
UNIQUE KEY `t_ds_alertgroup_name_un` (`group_name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
@ -352,7 +352,7 @@ CREATE TABLE `t_ds_datasource` (
|
||||
`create_time` datetime NOT NULL COMMENT 'create time',
|
||||
`update_time` datetime DEFAULT NULL COMMENT 'update time',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `t_ds_datasource_name_UN` (`name`, `type`)
|
||||
UNIQUE KEY `t_ds_datasource_name_un` (`name`, `type`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -209,7 +209,7 @@ CREATE TABLE t_ds_alertgroup(
|
||||
create_time timestamp DEFAULT NULL,
|
||||
update_time timestamp DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT t_ds_alertgroup_name_UN UNIQUE (group_name)
|
||||
CONSTRAINT t_ds_alertgroup_name_un UNIQUE (group_name)
|
||||
) ;
|
||||
|
||||
--
|
||||
@ -250,7 +250,7 @@ CREATE TABLE t_ds_datasource (
|
||||
create_time timestamp NOT NULL ,
|
||||
update_time timestamp DEFAULT NULL ,
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT t_ds_datasource_name_UN UNIQUE (name, type)
|
||||
CONSTRAINT t_ds_datasource_name_un UNIQUE (name, type)
|
||||
) ;
|
||||
|
||||
--
|
||||
|
@ -581,9 +581,9 @@ BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM information_schema.STATISTICS
|
||||
WHERE TABLE_NAME='t_ds_alertgroup'
|
||||
AND TABLE_SCHEMA=(SELECT DATABASE())
|
||||
AND INDEX_NAME ='t_ds_alertgroup_name_UN')
|
||||
AND INDEX_NAME ='t_ds_alertgroup_name_un')
|
||||
THEN
|
||||
ALTER TABLE t_ds_alertgroup ADD UNIQUE KEY `t_ds_alertgroup_name_UN` (`group_name`);
|
||||
ALTER TABLE t_ds_alertgroup ADD UNIQUE KEY `t_ds_alertgroup_name_un` (`group_name`);
|
||||
END IF;
|
||||
END;
|
||||
|
||||
@ -598,12 +598,12 @@ drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_datasource_A_add_UN_datasourceName;
|
||||
delimiter d//
|
||||
CREATE PROCEDURE uc_dolphin_T_t_ds_datasource_A_add_UN_datasourceName()
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
|
||||
IF NOT EXISTS (SELECT 1 FROM information_schema.STATISTICS
|
||||
WHERE TABLE_NAME='t_ds_datasource'
|
||||
AND TABLE_SCHEMA=(SELECT DATABASE())
|
||||
AND COLUMN_NAME ='t_ds_datasource_name_UN')
|
||||
AND INDEX_NAME ='t_ds_datasource_name_un')
|
||||
THEN
|
||||
ALTER TABLE t_ds_datasource ADD UNIQUE KEY `t_ds_datasource_name_UN` (`name`, `type`);
|
||||
ALTER TABLE t_ds_datasource ADD UNIQUE KEY `t_ds_datasource_name_un` (`name`, `type`);
|
||||
END IF;
|
||||
END;
|
||||
|
||||
|
@ -611,9 +611,9 @@ CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_alertgroup_A_add_UN_groupName() RET
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_stat_all_indexes
|
||||
WHERE relname='t_ds_alertgroup'
|
||||
AND indexrelname ='t_ds_alertgroup_name_UN')
|
||||
AND indexrelname ='t_ds_alertgroup_name_un')
|
||||
THEN
|
||||
ALTER TABLE t_ds_alertgroup ADD CONSTRAINT t_ds_alertgroup_name_UN UNIQUE (group_name);
|
||||
ALTER TABLE t_ds_alertgroup ADD CONSTRAINT t_ds_alertgroup_name_un UNIQUE (group_name);
|
||||
END IF;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
@ -629,9 +629,9 @@ CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_datasource_A_add_UN_datasourceName(
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_stat_all_indexes
|
||||
WHERE relname='t_ds_datasource'
|
||||
AND indexrelname ='t_ds_datasource_name_UN')
|
||||
AND indexrelname ='t_ds_datasource_name_un')
|
||||
THEN
|
||||
ALTER TABLE t_ds_datasource ADD CONSTRAINT t_ds_datasource_name_UN UNIQUE (name, type);
|
||||
ALTER TABLE t_ds_datasource ADD CONSTRAINT t_ds_datasource_name_un UNIQUE (name, type);
|
||||
END IF;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
Loading…
Reference in New Issue
Block a user