You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
584 B
28 lines
584 B
|
1 month ago
|
USE `data_center_new`;
|
||
|
|
|
||
|
|
DROP procedure IF EXISTS `add_column`;
|
||
|
|
|
||
|
|
DELIMITER $$
|
||
|
|
|
||
|
|
CREATE PROCEDURE add_column()
|
||
|
|
|
||
|
|
BEGIN
|
||
|
|
IF NOT EXISTS (
|
||
|
|
SELECT *
|
||
|
|
FROM information_schema.columns
|
||
|
|
WHERE table_schema = 'data_center_new'
|
||
|
|
AND table_name = 'device_alert_template'
|
||
|
|
AND column_name = 'effective_period'
|
||
|
|
) THEN
|
||
|
|
ALTER TABLE device_alert_template
|
||
|
|
ADD COLUMN `effective_period` varchar(200) DEFAULT NULL COMMENT '告警有效时间段';
|
||
|
|
END IF;
|
||
|
|
|
||
|
|
END$$
|
||
|
|
|
||
|
|
DELIMITER ;
|
||
|
|
|
||
|
|
|
||
|
|
CALL add_column();
|
||
|
|
|
||
|
|
DROP procedure IF EXISTS `add_column`;
|