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 = 'basic_monitoring_asset' 
        AND column_name = 'external_file'
    ) THEN
        ALTER TABLE basic_monitoring_asset 
        ADD COLUMN `external_file` text COMMENT '关联外部文件url';
    END IF;
    
END$$

DELIMITER ;


CALL add_column();

DROP procedure IF EXISTS `add_column`;