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

set_time_limit(0);

if (Db::i()->selectCell("SELECT module_id FROM ?_modules WHERE module='admin_pages'")) {
	Db::i()->query(
		"ALTER TABLE ?_pages CHANGE `page_title` `title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
		CHANGE `page_text` `text` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
		CHANGE `page_description` `description` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
		CHANGE `page_keywords` `keywords` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
		CHANGE `date_created` `created` INT( 10 ) UNSIGNED NOT NULL ,
		CHANGE `date_updated` `updated` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"
	);
}

if (Db::i()->selectCell("SELECT module_id FROM ?_modules WHERE module='bug_tracker'")) {
	Db::i()->query("ALTER TABLE ?_bt_bugs DROP `project_id`");
	Db::i()->query("ALTER TABLE ?_bt_versions DROP `project_id`");
	$id=Db::i()->query("INSERT INTO ?_bt_versions (`version`) VALUES ('HEAD')");
	Db::i()->query("UPDATE ?_bt_bugs SET version_id=? WHERE version_id = -1", $id);
	Db::i()->query("ALTER TABLE ?_bt_files CHANGE `file_name` `name` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
CHANGE `file_type` `type` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ");
}



