<?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;

if (Db::instance()->selectCell("SELECT module_id FROM ?_modules WHERE module='forum'")) {
	Db::instance()->query("ALTER TABLE ?_forum_posts ADD `edited` VARCHAR( 20 ) NULL");
	Db::instance()->query("ALTER TABLE ?_forum_themes ADD `hidden` INT NULL");
	Db::instance()->query(
		"CREATE TABLE IF NOT EXISTS ?_forum_hposts (
		`post_id` int(11) NOT NULL,
		`theme_id` int(11) NOT NULL default '0',
		`user_id` int(11) default NULL,
		`user_name` varchar(50) default NULL,
		`msg` text NOT NULL,
		`email` varchar(30) default NULL,
		`putdate` datetime default '0000-00-00 00:00:00',
		`ip` bigint(20) default '0',
		`edited` varchar(20) default NULL,
		PRIMARY KEY  (`post_id`)
		) ENGINE=MyISAM  DEFAULT CHARSET=utf8;"
	);
	Db::instance()->query(
		"CREATE TABLE IF NOT EXISTS ?_forum_hthemes (
		`theme_id` int(11) NOT NULL,
		`forum_id` int(11) default NULL,
		`author` varchar(32) default NULL,
		`author_id` int(11) default NULL,
		`subject` varchar(60) NOT NULL default '',
		`total_posts` int(11) NOT NULL default '0',
		`last_post` datetime default '0000-00-00 00:00:00',
		`last_user` varchar(32) default NULL,
		`last_user_id` int(11) default NULL,
		`pinup` tinyint(4) NOT NULL,
		`hidden` int(11) default NULL,
		PRIMARY KEY  (`theme_id`)
		) ENGINE=MyISAM  DEFAULT CHARSET=utf8;"
	);
}