CREATE TABLE IF NOT EXISTS ?_comments (
  `comment_id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) DEFAULT NULL,
  `item_id` int(11) NOT NULL,
  `text` text,
  `putdate` int(10) unsigned NOT NULL,
  `updated` int(10) unsigned NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `login` varchar(20) DEFAULT NULL,
  `email` varchar(50) DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `level` tinyint(1) NOT NULL DEFAULT '0',
  `left_key` int(11) NOT NULL,
  `right_key` int(11) NOT NULL,
  `abuse` varchar(255) DEFAULT NULL,
  `ip` varbinary(16) default NULL,
  `total_votes` int(11) NOT NULL DEFAULT '0',
  `vote_result` int(11) NOT NULL DEFAULT '0',
  `rating` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`comment_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS ?_comments_items (
  `item_id` int(11) NOT NULL AUTO_INCREMENT,
  `key` int(11) NOT NULL,
  `type` tinyint(4) NOT NULL DEFAULT '1',
  `url` varchar(150) NOT NULL,
  `title` varchar(150) NOT NULL,
  `module_id` int(11) NOT NULL,
  `counter` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`item_id`),
  UNIQUE KEY `module_id` (`module_id`,`key`),
  KEY `item_key` (`key`,`module_id`,`item_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;