CREATE TABLE `ip_addresses` (
  `id` int(11) NOT NULL auto_increment,
  `address` varchar(20) NOT NULL default '',
  `first_byte` int(11) default NULL,
  `second_byte` int(11) default NULL,
  `third_byte` int(11) default NULL,
  `fourth_byte` int(11) default NULL,
  PRIMARY KEY  (`id`),
  KEY `ip_address_address` (`address`)
) TYPE=InnoDB;

CREATE TABLE `page_version_contents` (
  `id` int(11) NOT NULL auto_increment,
  `content` mediumtext NOT NULL,
  `page_version_id` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) TYPE=InnoDB;

CREATE TABLE `page_versions` (
  `id` int(11) NOT NULL auto_increment,
  `version` int(11) NOT NULL default '0',
  `date_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `url_count` int(11) default NULL,
  `page_id` int(11) NOT NULL default '0',
  `user_name_id` int(11) NOT NULL default '0',
  `ip_address_id` int(11) NOT NULL default '0',
  `content_size` int(11) default NULL,
  `page_name` varchar(255) default NULL,
  `user_name_string` varchar(255) default NULL,
  `ip_address_string` varchar(255) default NULL,
  `delta_urls` int(11) default NULL,
  PRIMARY KEY  (`id`),
  KEY `page_version_page_id_and_version` (`page_id`,`version`),
  KEY `page_version_ip_address_id` (`ip_address_id`),
  KEY `page_version_user_name_id` (`user_name_id`),
  KEY `page_version_date_time` (`date_time`)
) TYPE=InnoDB;

CREATE TABLE `pages` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `page_name` (`name`)
) TYPE=InnoDB;

CREATE TABLE `user_names` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `user_name_name` (`name`)
) TYPE=InnoDB;

