CREATE DATABASE IF NOT EXISTS `v8_voprimary` DEFAULT CHARACTER SET latin1;

USE `v8_voprimary`;

DROP TABLE IF EXISTS `vd_donations`;
CREATE TABLE `vd_donations` (
  `mailed_key` varchar(20) DEFAULT NULL,
  `amount` int(11) DEFAULT NULL,
  `created` date DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vd_features`;
CREATE TABLE `vd_features` (
  `feature_id` varchar(15) DEFAULT NULL,
  `sort_id` varchar(15) DEFAULT NULL,
  `description` varchar(100) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vd_votes`;
CREATE TABLE `vd_votes` (
  `user_id` int(11) DEFAULT NULL,
  `vote_nr` int(11) DEFAULT NULL,
  `points` int(11) DEFAULT NULL,
  `feature_id` varchar(15) DEFAULT NULL,
  `expire_date` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vo_news_items`;
CREATE TABLE `vo_news_items` (
  `news_item_id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(80) DEFAULT NULL,
  `news` mediumtext,
  `created_by` int(11) DEFAULT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`news_item_id`)
) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vs_script_downloads`;
CREATE TABLE `vs_script_downloads` (
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `script_id` int(11) DEFAULT NULL,
  `ip` varchar(255) DEFAULT NULL,
  KEY `vssd_id_ip` (`script_id`,`ip`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vs_script_ratings`;
CREATE TABLE `vs_script_ratings` (
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `script_id` int(11) DEFAULT NULL,
  `rating` int(11) DEFAULT NULL,
  `ip` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vs_script_source`;
CREATE TABLE `vs_script_source` (
  `script_source_id` int(11) NOT NULL AUTO_INCREMENT,
  `mime_type` varchar(40) DEFAULT NULL,
  `script_id` int(11) DEFAULT NULL,
  `vim_version` varchar(10) DEFAULT NULL,
  `script_version` varchar(10) DEFAULT NULL,
  `version_comment` mediumtext,
  `src` longblob,
  `created_by` int(11) DEFAULT NULL,
  `creation_date` datetime DEFAULT NULL,
  `package` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`script_source_id`),
  KEY `source_date` (`creation_date`),
  KEY `vss_sid_creator` (`script_id`,`created_by`)
) ENGINE=MyISAM AUTO_INCREMENT=15092 DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vs_scripts`;
CREATE TABLE `vs_scripts` (
  `script_id` int(11) NOT NULL AUTO_INCREMENT,
  `script_name` varchar(40) DEFAULT NULL,
  `script_type` varchar(40) DEFAULT NULL,
  `summary` varchar(80) DEFAULT NULL,
  `description` longtext,
  `install_details` mediumtext,
  `ratings` int(11) DEFAULT NULL,
  `rating_score` int(11) DEFAULT NULL,
  `downloads` int(11) DEFAULT NULL,
  `last_updated_by` int(11) DEFAULT NULL,
  `last_update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created_by` int(11) DEFAULT NULL,
  `creation_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`script_id`),
  FULLTEXT KEY `summary` (`summary`,`description`,`install_details`)
) ENGINE=MyISAM AUTO_INCREMENT=3465 DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vs_sessions`;
CREATE TABLE `vs_sessions` (
  `session_id` varchar(32) NOT NULL DEFAULT '',
  `user_id` int(11) DEFAULT NULL,
  `remote_address` varchar(200) DEFAULT NULL,
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`session_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vs_users`;
CREATE TABLE `vs_users` (
  `user_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_name` varchar(40) DEFAULT NULL,
  `password` varchar(32) DEFAULT NULL,
  `first_name` varchar(40) DEFAULT NULL,
  `last_name` varchar(40) DEFAULT NULL,
  `email` varchar(200) DEFAULT NULL,
  `access` int(11) DEFAULT NULL,
  `homepage` varchar(255) DEFAULT NULL,
  `sponsor_amount` int(11) DEFAULT NULL,
  `sponsor_vote_amount` int(11) DEFAULT NULL,
  `sponsor_vote_date` date DEFAULT NULL,
  `sponsor_flags` int(11) DEFAULT NULL,
  PRIMARY KEY (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=27147 DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vt_tip_note_spam`;
CREATE TABLE `vt_tip_note_spam` (
  `tip_spam_note_id` int(11) NOT NULL AUTO_INCREMENT,
  `moderated_by` int(11) NOT NULL DEFAULT '0',
  `moderated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `tip_note_id` int(11) NOT NULL DEFAULT '0',
  `tip_id` int(11) NOT NULL DEFAULT '0',
  `note` longtext NOT NULL,
  `created_by` varchar(40) NOT NULL DEFAULT '',
  `created_by_email` varchar(100) NOT NULL DEFAULT '',
  `last_update_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `creation_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `last_updated_by_email` varchar(100) NOT NULL DEFAULT '',
  PRIMARY KEY (`tip_spam_note_id`)
) ENGINE=MyISAM AUTO_INCREMENT=4795 DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vt_tip_notes`;
CREATE TABLE `vt_tip_notes` (
  `tip_note_id` int(11) NOT NULL AUTO_INCREMENT,
  `tip_id` int(11) DEFAULT NULL,
  `note` longtext,
  `last_updated_by_email` varchar(100) DEFAULT NULL,
  `last_update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created_by` varchar(40) DEFAULT NULL,
  `created_by_email` varchar(100) DEFAULT NULL,
  `creation_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`tip_note_id`)
) ENGINE=MyISAM AUTO_INCREMENT=12968 DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vt_tip_ratings`;
CREATE TABLE `vt_tip_ratings` (
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `tip_id` int(11) DEFAULT NULL,
  `rating` int(11) DEFAULT NULL,
  `ip` varchar(255) DEFAULT NULL,
  KEY `vt_tip_ratings_n1` (`ip`),
  KEY `vt_tip_ratings_n2` (`tip_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vt_tip_spam`;
CREATE TABLE `vt_tip_spam` (
  `tip_spam_id` int(11) NOT NULL AUTO_INCREMENT,
  `moderated_by` int(11) DEFAULT NULL,
  `moderated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `tip_id` int(11) DEFAULT NULL,
  `summary` varchar(200) DEFAULT NULL,
  `tip` longtext,
  `version` enum('5.7','6.0') DEFAULT NULL,
  `complexity` enum('basic','intermediate','advanced') DEFAULT NULL,
  `last_updated_by_email` varchar(100) DEFAULT NULL,
  `last_update_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `created_by` varchar(40) DEFAULT NULL,
  `created_by_email` varchar(100) DEFAULT NULL,
  `creation_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `ratings` int(11) DEFAULT NULL,
  `rating_score` int(11) DEFAULT NULL,
  `viewed` int(11) DEFAULT NULL,
  PRIMARY KEY (`tip_spam_id`)
) ENGINE=MyISAM AUTO_INCREMENT=177 DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `vt_tip_views`;
CREATE TABLE `vt_tip_views` (
  `creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `tip_id` int(11) DEFAULT NULL,
  `ip` varchar(255) DEFAULT NULL,
  KEY `vt_tip_views_n1` (`ip`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
