DROP TABLE IF EXISTS `contact_us`;
CREATE TABLE IF NOT EXISTS `contact_us` (
  `contact_us_id` smallint(10) NOT NULL AUTO_INCREMENT,
  `date_create` int(11) NOT NULL,
  `date_modify` int(11) NOT NULL DEFAULT '0',
  `name` varchar(64) NOT NULL,
  `email_address` varchar(255) NOT NULL,
  `subject` varchar(255) NOT NULL,
  `message` text NOT NULL,
  PRIMARY KEY (`contact_us_id`)
) TYPE=MyISAM;


DROP TABLE IF EXISTS `email`;
CREATE TABLE IF NOT EXISTS `email` (
  `email_id` tinyint(2) NOT NULL AUTO_INCREMENT,
  `date_create` int(11) NOT NULL,
  `date_modify` int(11) NOT NULL DEFAULT '0',
  `locale` varchar(16) NOT NULL,
  `name` varchar(32) NOT NULL,
  `subject` varchar(255) NOT NULL,
  `body` text NOT NULL,
  `alt_body` text NOT NULL,
  PRIMARY KEY (`email_id`)
) TYPE=MyISAM ;

INSERT INTO `email` (`email_id`, `date_create`, `date_modify`, `locale`, `name`, `subject`, `body`, `alt_body`) VALUES
(1, 1252294556, 0, 'en_US.UTF-8', 'account-register-business', 'Thank you for registering!', '<p>Dear {firstname},</p>\r\n\r\n<p>Thank you for registering your account with <a href="{site_url}">{site_url}</a>!</p>\r\n\r\n<p>We are here to help you. Please let us know of any questions you have or comments to improve the site for a better experience.</p>\r\n\r\n<p>Thanks,</p>\r\n<p>-The Team At {site_url}</p>', 'Dear {firstname},\r\n\r\nThank you for registering your account with {site_url}!\r\n\r\nWe are here to help you. Please let us know of any questions you have or comments to improve the site for a better experience.\r\n\r\nThanks,\r\n-The Team At {site_url}'),
(3, 1252294857, 0, 'en_US.UTF-8', 'account-pending-comment', 'You have a pending comment to review', '<p>Dear {firstname},</p>\r\n\r\n<p>Your profile is getting attention! You have a pending comment that another member left for you to either approve or decline.</p>\r\n\r\n<p>This is your profile and you control what others see. To approve or to decline the comment, click below:</p>\r\n\r\n<p><a href="{site_url}comment/index/pending">{site_url}comment/index/pending</a></p>\r\n\r\n<p>Thanks,</p>\r\n<p>-The Team At <a href="{site_url}">{site_url}</a></p>', 'Dear {firstname},\r\n\r\nYour profile is getting attention! You have a pending comment that another member left for you to either approve or decline.\r\n\r\nThis is your profile and you control what others see. To approve or to decline the comment, click below:\r\n\r\n{site_url}comment/index/pending\r\n\r\nThanks,\r\n-The Team At {site_url}'),
(4, 1252294857, 0, 'en_US.UTF-8', 'account-pending-contact', 'You have a pending contact to approve or deny', '<p>Dear {firstname},</p>\r\n\r\n<p>Someone wants to show that they know you. You have a pending friend.</p>\r\n\r\n<p>This is your profile so you have the power to approve, decline, or relate the friend.</p>\r\n\r\n<p>To approve, decline, or relate your potential friend, click below:</p>\r\n\r\n<p><a href="{site_url}contact/index/pending">{site_url}contact/index/pending</a></p>\r\n\r\n<p>Thanks,</p>\r\n<p>-The Team At <a href="{site_url}">{site_url}</a></p>', 'Dear {firstname},\r\n\r\nSomeone wants to show that they know you. You have a pending friend.\r\n\r\nThis is your profile so you have the power to approve, decline, or relate the friend.\r\n\r\nTo approve, decline, or relate your potential friend, click below:\r\n\r\n{site_url}contact/index/pending\r\n\r\nThanks,\r\n-The Team At {site_url}'),
(5, 1252295179, 0, 'en_US.UTF-8', 'account-video-converted', 'Your video is ready to be viewed!', '<p>Dear {firstname},</p>\r\n\r\n<p>Congratulations! Your video is uploaded and can now be viewed on your profile page.</p>\r\n \r\n<p>To see your video, please click on the following link:</p>\r\n<p><a href="{site_url}profile/{username}">{site_url}profile/{username}</a></p>\r\n\r\n<p>Thanks,</p>\r\n<p>-The Team At <a href="{site_url}">{site_url}</a></p>', 'Dear {firstname},\r\n\r\nCongratulations! Your video is uploaded and can now be viewed on your profile page.\r\n \r\nTo see your video, please click on the following link:\r\n{site_url}profile/{username}\r\n\r\nThanks,\r\n-The Team At {site_url}'),
(9, 1252299445, 0, 'en_US.UTF-8', 'account-new-video', 'Congratulations on uploading your video!', '<p>Dear {firstname},</p>\r\n\r\n<p>Congratulations on uploading your video!</p>\r\n\r\n<p>Please give us a moment while we convert your video to the proper web format. You will receive another email when the conversion is complete.</p>\r\n\r\n<p>Thanks,</p>\r\n<p>-The Team At <a href="{site_url}">{site_url}</a></p>', 'Dear {firstname},\r\n\r\nCongratulations on uploading your video!\r\n\r\nPlease give us a moment while we convert your video to the proper web format. You will receive another email when the conversion is complete.\r\n\r\nThanks,\r\n-The Team At {site_url}'),
(11, 1252328941, 0, 'en_US.UTF-8', 'contact-us', 'Contact Us Submission', '<p>You have received a new Contact Us submission from "{name}".</p>\r\n\r\n<p>----------------------------------------</p>\r\n<p>{message}</p>\r\n<p>----------------------------------------</p>', 'You have received a new Contact Us submission from "{name}". \r\n\r\n----------------------------------------\r\n{message}\r\n----------------------------------------'),
(15, 1253010388, 0, 'en_US.UTF-8', 'account-new-message', 'New Private Message', '<p>Dear {firstname},</p>\r\n\r\n<p>You have a new Private Message!</p>\r\n\r\n<p>Click the link below to view it and reply.</p>\r\n\r\n<p><em>{subject}</em></p>\r\n<p><a href="{site_url}inbox/view/{message_id}">{site_url}inbox/view/{message_id}</a></p>\r\n\r\n<p>Thanks,</p>\r\n<p>-The Team At {site_url}</p>', 'Dear {firstname},\r\n\r\nYou have a new Private Message!\r\n\r\nClick the link below to view it and reply.\r\n\r\n"{subject}"\r\n{site_url}inbox/view/{message_id}\r\n\r\nThanks,\r\n-The Team At {site_url}');

DROP TABLE IF EXISTS `log`;
CREATE TABLE IF NOT EXISTS `log` (
  `code_id` int(10) NOT NULL AUTO_INCREMENT,
  `log_date` datetime NOT NULL,
  `entry` text NOT NULL,
  `trace` text,
  `class` varchar(255) DEFAULT NULL,
  `function` varchar(255) DEFAULT NULL,
  `ip_address` varchar(24) NOT NULL,
  `type` int(5) NOT NULL,
  PRIMARY KEY (`code_id`)
) TYPE=MyISAM;


DROP TABLE IF EXISTS `page`;
CREATE TABLE IF NOT EXISTS `page` (
  `page_id` int(11) NOT NULL AUTO_INCREMENT,
  `date_create` int(11) NOT NULL,
  `date_modify` int(11) NOT NULL DEFAULT '0',
  `name` varchar(64) NOT NULL,
  `title` varchar(64) NOT NULL,
  `content` text NOT NULL,
  `view_count` int(10) NOT NULL DEFAULT '0',
  `status` tinyint(1) NOT NULL,
  PRIMARY KEY (`page_id`)
) TYPE=MyISAM ;

INSERT INTO `page` (`page_id`, `date_create`, `date_modify`, `name`, `title`, `content`, `view_count`, `status`) VALUES
(1, 1253382708, 0, 'about-us', 'About My Social Network', '<p class="page-first"> \r\n	Add content about your social network here. Encourage members to register.\r\n</p>', 0, 1),
(2, 1253382708, 0, 'faq', 'Frequently Asked Questions', '<h4>What is www.kwolla.com?</h4>\r\n<p class="page">\r\n	Write some questions that have been asked about your social network and add them here. Each question can use an h4 tag\r\n	and each response can use a p tag like so:\r\n</p>\r\n<pre>&lt;h4&gt;Here is a sample question&lt;/h4&gt;\r\n&lt;p&gt;The response is written here.&lt;/p&gt;</pre>', 0, 1);

DROP TABLE IF EXISTS `search_index`;
CREATE TABLE IF NOT EXISTS `search_index` (
  `search_index_id` int(10) NOT NULL AUTO_INCREMENT,
  `user_id` int(10) NOT NULL,
  `search_zone_id` tinyint(2) NOT NULL,
  `search_token_id` mediumint(9) NOT NULL,
  `count` tinyint(2) NOT NULL,
  `weight` float NOT NULL,
  PRIMARY KEY (`search_index_id`)
) TYPE=MyISAM;


DROP TABLE IF EXISTS `search_log`;
CREATE TABLE IF NOT EXISTS `search_log` (
  `search_log_id` int(10) NOT NULL AUTO_INCREMENT,
  `date_create` int(11) NOT NULL DEFAULT '0',
  `date_modify` int(11) NOT NULL DEFAULT '0',
  `user_id` int(10) NOT NULL,
  `query` varchar(255) NOT NULL,
  PRIMARY KEY (`search_log_id`),
  KEY `user_id` (`user_id`)
) TYPE=MyISAM;


DROP TABLE IF EXISTS `search_token`;
CREATE TABLE IF NOT EXISTS `search_token` (
  `search_token_id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `token` varchar(255) binary NOT NULL,
  PRIMARY KEY (`search_token_id`),
  UNIQUE KEY `token` (`token`)
) TYPE=MyISAM;


DROP TABLE IF EXISTS `search_zone`;
CREATE TABLE IF NOT EXISTS `search_zone` (
  `search_zone_id` tinyint(2) NOT NULL AUTO_INCREMENT,
  `date_create` int(11) NOT NULL,
  `date_modify` int(11) NOT NULL DEFAULT '0',
  `name` varchar(64) NOT NULL,
  `field` varchar(64) NOT NULL,
  `weight` tinyint(1) NOT NULL DEFAULT '1',
  `type` tinyint(1) NOT NULL,
  PRIMARY KEY (`search_zone_id`)
) TYPE=MyISAM ;

INSERT INTO `search_zone` (`search_zone_id`, `date_create`, `date_modify`, `name`, `field`, `weight`, `type`) VALUES
(1, 0, 0, 'First Name', 'firstname', 10, 1),
(2, 0, 0, 'Last Name', 'lastname', 10, 1),
(3, 0, 0, 'Address', 'address', 1, 2),
(4, 0, 0, 'City', 'city', 1, 2),
(5, 0, 0, 'State', 'state', 1, 2),
(6, 0, 0, 'Post Code', 'postcode', 1, 2),
(7, 0, 0, 'Country', 'country', 1, 2),
(11, 0, 0, 'Comments', 'comments', 1, 1),
(9, 0, 0, 'Company', 'company', 10, 1);

DROP TABLE IF EXISTS `session`;
CREATE TABLE IF NOT EXISTS `session` (
  `session_id` varchar(64) NOT NULL,
  `session_expiration_time` int(11) NOT NULL,
  `ip` varchar(20) NOT NULL,
  `user_agent` varchar(255) NOT NULL,
  `user_agent_hash` varchar(64) NOT NULL,
  `session_data` text,
  PRIMARY KEY (`session_id`)
) TYPE=MyISAM;


DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (
  `user_id` int(10) NOT NULL AUTO_INCREMENT,
  `date_create` int(11) NOT NULL,
  `date_modify` int(11) NOT NULL DEFAULT '0',
  `date_lastlogin` int(11) NOT NULL DEFAULT '0',
  `forum_id` int(10) NOT NULL,
  `user_video_id` int(10) NOT NULL,
  `referral_id` int(10) NOT NULL,
  `promo_id` smallint(1) NOT NULL,
  `language` char(11) NOT NULL,
  `time_offset` tinyint(1) NOT NULL DEFAULT '0',
  `type` tinyint(1) NOT NULL,
  `gender` tinyint(1) NOT NULL DEFAULT '1',
  `complete` tinyint(1) NOT NULL DEFAULT '0',
  `email_address` varchar(255) NOT NULL,
  `password` varchar(96) NOT NULL,
  `password_salt` varchar(96) NOT NULL,
  `password_reset` tinyint(1) NOT NULL DEFAULT '1',
  `username` varchar(32) NOT NULL,
  `firstname` varchar(64) NOT NULL,
  `lastname` varchar(64) NOT NULL,
  `company` varchar(128) NOT NULL,
  `comments` text NOT NULL,
  `url` varchar(255) NOT NULL,
  `twitter` varchar(128) NOT NULL,
  `facebook` varchar(255) NOT NULL,
  `linkedin` varchar(255) NOT NULL,
  `flickr` varchar(128) NOT NULL,
  `posterous` varchar(128) NOT NULL,
  `tumblr` varchar(128) NOT NULL,
  `content_directory` mediumtext NOT NULL,
  `profile_picture` varchar(96) NOT NULL,
  `profile_picture_med` varchar(96) NOT NULL,
  `profile_picture_tn` varchar(96) NOT NULL,
  `upgrade` tinyint(1) NOT NULL DEFAULT '0',
  `office_status` tinyint(1) NOT NULL DEFAULT '1',
  `status` tinyint(1) NOT NULL,
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `email_address` (`email_address`),
  KEY `video_id` (`user_video_id`),
  KEY `username` (`username`)
) TYPE=MyISAM;


DROP TABLE IF EXISTS `user_activity`;
CREATE TABLE IF NOT EXISTS `user_activity` (
  `user_activity_id` int(11) NOT NULL AUTO_INCREMENT,
  `date_create` int(11) NOT NULL,
  `date_modify` int(11) NOT NULL DEFAULT '0',
  `user_id` int(11) NOT NULL,
  `profile_id` int(11) NOT NULL DEFAULT '0',
  `username` varchar(32) NOT NULL,
  `fullname` varchar(96) NOT NULL,
  `content_directory` mediumtext NOT NULL,
  `profile_picture_tn` varchar(96) NOT NULL,
  `profile_username` varchar(32) DEFAULT NULL,
  `profile_fullname` varchar(96) DEFAULT NULL,
  `content` mediumtext NOT NULL,
  `view` varchar(32) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`user_activity_id`)
) TYPE=MyISAM;


DROP TABLE IF EXISTS `user_comment`;
CREATE TABLE IF NOT EXISTS `user_comment` (
  `user_comment_id` int(10) NOT NULL AUTO_INCREMENT,
  `date_create` int(11) NOT NULL,
  `date_modify` int(11) NOT NULL DEFAULT '0',
  `from_user_id` int(10) NOT NULL,
  `to_user_id` int(10) NOT NULL,
  `comment` varchar(255) NOT NULL,
  `status` tinyint(1) NOT NULL,
  PRIMARY KEY (`user_comment_id`),
  KEY `from_user_id` (`from_user_id`),
  KEY `to_user_id` (`to_user_id`)
) TYPE=MyISAM;


DROP TABLE IF EXISTS `user_contact`;
CREATE TABLE IF NOT EXISTS `user_contact` (
  `user_contact_id` int(10) NOT NULL AUTO_INCREMENT,
  `date_create` int(11) NOT NULL,
  `date_modify` int(11) NOT NULL DEFAULT '0',
  `from_user_id` int(10) NOT NULL,
  `to_user_id` int(10) NOT NULL,
  `comment` tinytext NOT NULL,
  `related` tinyint(1) NOT NULL DEFAULT '0',
  `status` tinyint(1) NOT NULL,
  PRIMARY KEY (`user_contact_id`),
  KEY `from_user_id` (`from_user_id`),
  KEY `to_user_id` (`to_user_id`)
) TYPE=MyISAM;


DROP TABLE IF EXISTS `user_message`;
CREATE TABLE IF NOT EXISTS `user_message` (
  `user_message_id` int(10) NOT NULL AUTO_INCREMENT,
  `date_create` int(11) NOT NULL,
  `date_modify` int(11) NOT NULL DEFAULT '0',
  `date_lastpost` int(11) NOT NULL,
  `parent_id` int(10) NOT NULL DEFAULT '0',
  `user_id` int(10) NOT NULL,
  `subject` varchar(128) NOT NULL,
  `body` text NOT NULL,
  `view_count` smallint(3) NOT NULL DEFAULT '0',
  `status` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`user_message_id`),
  KEY `user_id` (`user_id`)
) TYPE=MyISAM;


DROP TABLE IF EXISTS `user_message_member`;
CREATE TABLE IF NOT EXISTS `user_message_member` (
  `user_message_member_id` int(10) NOT NULL AUTO_INCREMENT,
  `date_create` int(11) NOT NULL,
  `date_modify` int(11) NOT NULL DEFAULT '0',
  `user_message_id` int(10) NOT NULL,
  `user_id` int(10) NOT NULL,
  PRIMARY KEY (`user_message_member_id`)
) TYPE=MyISAM;


DROP TABLE IF EXISTS `user_statistic`;
CREATE TABLE IF NOT EXISTS `user_statistic` (
  `user_statistic_id` int(10) NOT NULL AUTO_INCREMENT,
  `date_create` int(11) NOT NULL,
  `date_modify` int(11) NOT NULL DEFAULT '0',
  `from_user_id` int(10) NOT NULL,
  `to_user_id` int(10) NOT NULL,
  `type` smallint(5) NOT NULL,
  `processed` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`user_statistic_id`),
  KEY `user_id` (`from_user_id`)
) TYPE=MyISAM;


DROP TABLE IF EXISTS `user_status`;
CREATE TABLE IF NOT EXISTS `user_status` (
  `user_status_id` int(10) NOT NULL AUTO_INCREMENT,
  `date_create` int(11) NOT NULL,
  `date_modify` int(11) NOT NULL DEFAULT '0',
  `user_id` int(10) NOT NULL,
  `value` varchar(255) NOT NULL,
  PRIMARY KEY (`user_status_id`),
  KEY `user_id` (`user_id`)
) TYPE=MyISAM;