# take out the old ip_address field of the db_monitor_alert_rules table in favor of the new host_name field
# this WILL mean that hosts to monitor will have to be specified again, as every alert rule will be changed
# to "any" host

ALTER TABLE dm_monitor_alert_rules DROP  ip_addr;


ALTER TABLE dm_monitor_alert_rules ADD  host_name varchar(100);

# this is for the DNS check feature now built in to the host/service monitor
ALTER TABLE dm_monitor_current ADD check_dns int(1) DEFAULT 0;


ALTER TABLE dm_sessions ADD f3 int(1) NOT NULL DEFAULT 0;


ALTER TABLE dm_monitor_alerts_raw MODIFY host_name varchar(100);


ALTER TABLE dm_monitor_events ADD  host_name varchar(100);

###########################################
#Needed for all versions < 1.05 RC2
ALTER TABLE dm_conf MODIFY snort_conf longtext;
ALTER TABLE dm_rules MODIFY snort_rules longtext;


# dm_general_alerts table needs to be added to allow
# demarcd clients to communicate errors back to the
# main client/ web interface


CREATE TABLE dm_general_alerts (
    sid INT(10),
    aid INT(10) PRIMARY KEY NOT NULL AUTO_INCREMENT,
    reporting_sid INT(10),
    timestamp_reported datetime NOT NULL DEFAULT "0",
    alert_level varchar(6) NOT NULL DEFAULT "RED",
    alert_message varchar(255) NOT NULL DEFAULT "EMPTY",
    required_admin_to_dismiss char(3)
);

