/* DROP OUR TABLE */
DROP TABLE IF EXISTS `spyders_live`;
DROP TABLE IF EXISTS `spyders_ip_cache`;
/* DROP TABLE IF EXISTS `spyders_blocks_log`; */

/* CREATE OUR TABLE */
CREATE TABLE IF NOT EXISTS `spyders_live` (
	`id` BIGINT(20) NOT NULL AUTO_INCREMENT, 
	`ip` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
	`type`	varchar(15) COLLATE utf8_unicode_ci NOT NULL,
	`agent` varchar(255) COLLATE utf8_unicode_ci NULL,
	`keywords` varchar(50)  COLLATE utf8_unicode_ci NULL,
	`dt_created` datetime NOT NULL,
	PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


CREATE TABLE IF NOT EXISTS `spyders_ip_cache` (
	`ip` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
	`country` char(20) COLLATE utf8_unicode_ci NOT NULL,
	PRIMARY KEY (`ip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE IF NOT EXISTS `spyders_blocks_log` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `date_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `block_reason` tinyint(1) unsigned DEFAULT NULL,
  `user_agent` varchar(256) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ip_address` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
  `country` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
  `country_code` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL,
  `dt_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

