CREATE TABLE IF NOT EXISTS `mod_bi_hosts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `host_id` int(11) DEFAULT NULL, `host_name` varchar(255) NOT NULL, `hc_id` int(11) DEFAULT NULL, `hc_name` varchar(255) NOT NULL, `hg_id` int(11) DEFAULT NULL, `hg_name` varchar(255) NOT NULL, PRIMARY KEY (`id`), KEY `hg_id` (`hg_id`), KEY `hc_id` (`hc_id`), KEY `host_id` (`host_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `mod_bi_services` ( `id` int(11) NOT NULL AUTO_INCREMENT, `service_id` int(11) NOT NULL, `service_description` varchar(255) NOT NULL, `sc_id` int(11) NOT NULL, `sc_name` varchar(255) NOT NULL, `host_id` int(11) DEFAULT NULL, `host_name` varchar(255) NOT NULL, `hc_id` int(11) DEFAULT NULL, `hc_name` varchar(255) NOT NULL, `hg_id` int(11) DEFAULT NULL, `hg_name` varchar(255) NOT NULL, PRIMARY KEY (`id`), KEY `hg_id` (`hg_id`), KEY `hc_id` (`hc_id`), KEY `sc_id` (`sc_id`), KEY `service_id` (`service_id`), KEY `host_id` (`host_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `mod_bi_servicecategories` ( `id` int(11) NOT NULL AUTO_INCREMENT, `sc_id` int(11) DEFAULT NULL, `sc_name` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `sc_id` (`sc_id`)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `mod_bi_hostgroups` ( `id` int(11) NOT NULL AUTO_INCREMENT, `hg_id` int(11) DEFAULT NULL, `hg_name` varchar(255) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id`), KEY `hg_id` (`hg_id`)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `mod_bi_hostcategories` ( `id` int(11) NOT NULL AUTO_INCREMENT, `hc_id` int(11) DEFAULT NULL, `hc_name` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `hc_id` (`hc_id`)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `mod_bi_servicemetrics` ( `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `metric_id` int(11) NOT NULL, `metric_name` varchar(1021) NOT NULL, `metric_unit` char(32) NULL, `service_id` int(11) NOT NULL, `service_description` varchar(255) NULL, `sc_id` int(11) NULL, `sc_name` varchar(255) NULL, `host_id` int(11) NULL, `host_name` varchar(255) NULL, `hg_id` int(11) NULL, `hg_name` varchar(255) NULL, `hc_id` int(11) NULL, `hc_name` varchar(255) NULL, PRIMARY KEY (`id`), KEY `hg_id` (`hg_id`), KEY `hc_id` (`hc_id`), KEY `sc_id` (`sc_id`), KEY `service_id` (`service_id`), KEY `host_id` (`host_id`), KEY `metric_id` (`metric_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `mod_bi_time` ( `id` int(11) NOT NULL AUTO_INCREMENT, `hour` tinyint(4) DEFAULT NULL, `day` tinyint(4) DEFAULT NULL, `month_label` char(9) DEFAULT NULL, `month` tinyint(4) DEFAULT NULL, `year` smallint(11) DEFAULT NULL, `week` tinyint(4) DEFAULT NULL, `dayofweek` char(9) DEFAULT NULL, `utime` int(11) DEFAULT NULL, `dtime` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `dtime` (`dtime`), KEY `dtime_utime` (`dtime`, `utime`)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `mod_bi_liveservice` ( `id` tinyint NOT NULL AUTO_INCREMENT, `name` varchar(200) CHARACTER SET utf8 NOT NULL, `timeperiod_id` int DEFAULT NULL, PRIMARY KEY (`id`), KEY `timeperiod_id` (`timeperiod_id`), KEY `name` (`name`)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `mod_bi_centiles` ( `id` int(11) NOT NULL, `centile_param` DECIMAL(7,4) NOT NULL, `liveservice_id` tinyint(4) NOT NULL, `tp_name` varchar(200) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `centile` (`centile_param`,`liveservice_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
