USE `lego`;

DROP PROCEDURE IF EXISTS add_udp_first_packet_check;
DELIMITER //
CREATE PROCEDURE add_udp_first_packet_check() BEGIN
    IF NOT EXISTS(SELECT * FROM information_schema.columns
           WHERE table_name = 't_vsm_zone_udpflood' AND column_name ='udp_first_packet_check_enable')
    THEN
        ALTER TABLE t_vsm_zone_udpflood ADD COLUMN udp_first_packet_check_enable BIT(1) DEFAULT NULL;
    END IF;
    IF NOT EXISTS(SELECT * FROM information_schema.columns
           WHERE table_name = 't_vsm_zone_udpflood' AND column_name ='udp_upper_limit')
    THEN
        ALTER TABLE t_vsm_zone_udpflood ADD COLUMN udp_upper_limit INT(11) DEFAULT NULL;
    END IF;
END;
//
DELIMITER ;
CALL add_udp_first_packet_check();

DROP PROCEDURE IF EXISTS add_udp_first_packet_check;