<?php
/*
* @package LabCMS
* @copyright (c) 2006 Alexander Levin aka Loki (loki_angel@mail.ru)
* @support http://labcms.ru
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
$success=true;

Db::i()->query("ALTER TABLE ?_pages ADD `use_comments` TINYINT NOT NULL DEFAULT '0'");
Db::i()->query(
	"CREATE TABLE IF NOT EXISTS ?_comments (
	`comment_id` int(11) NOT NULL auto_increment,
	`item_id` int(11) NOT NULL,
	`text` text,
	`putdate` datetime NOT NULL default '0000-00-00 00:00:00',
	`updated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
	`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` bigint(11) NOT NULL default '0',
	PRIMARY KEY  (`comment_id`)
	) ENGINE=MyISAM  DEFAULT CHARSET=utf8;"
);
Db::i()->query(
	"CREATE TABLE IF NOT EXISTS ?_comments_items (
	`item_id` int(11) NOT NULL auto_increment,
	`item_key` int(11) NOT NULL,
	`url` char(100) 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`,`item_key`),
	KEY `item_key` (`item_key`,`module_id`,`item_id`)
	) ENGINE=MyISAM  DEFAULT CHARSET=utf8;"
);

