USE `lego`;

DROP PROCEDURE IF EXISTS del_http_policy;
DELIMITER //
CREATE PROCEDURE del_http_policy() BEGIN
    IF EXISTS(SELECT * FROM information_schema.columns
           WHERE table_name = 't_vsm_zone_httpflood' AND column_name ='high_freq_detect_enable')
    THEN
        ALTER TABLE t_vsm_zone_httpflood DROP COLUMN high_freq_detect_enable;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN high_freq_detect_threshold;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN high_freq_detect_interval;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN http_fix_uri_enable;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN http_fix_uri_ratio_number;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN http_fix_uri_threshold;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN http_fix_uri_interval;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN large_res_detect_enable;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN large_res_size;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN large_res_detect_ratio;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN large_res_detect_threshold;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN large_res_detect_interval;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN http_illegal_session_check_enable;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN null_method_check;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN range_header_check;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN multi_get_check;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN http_illegal_session_num;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN http_illegal_session_interval;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN dest_ip_conn_num_enable;
		ALTER TABLE t_vsm_zone_httpflood DROP COLUMN dest_ip_conn_num;
    END IF;
END;
//
DELIMITER ;
CALL del_http_policy();

DROP PROCEDURE IF EXISTS del_http_policy;