USE `data_center_aeon_admin`;

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_aeon_admin'
        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`;