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

Db::i()->query("UPDATE ?_tree SET path='' WHERE path IS NULL");

Db::i()->query(
	"ALTER TABLE ?_tree CHANGE `path` `path` VARCHAR( 255 ) CHARACTER SET utf8
	COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `show` `show` TINYINT( 1 ) NOT NULL DEFAULT '1' "
);

if (Db::i()->selectCell("SELECT module_id FROM ?_modules WHERE module='lc_album'")) {
	Db::i()->query("ALTER TABLE ?_lc_album_albums ADD `updated1` INT UNSIGNED NULL DEFAULT NULL AFTER `updated`");
	Db::i()->query("ALTER TABLE ?_lc_album_images ADD `updated1` INT UNSIGNED NULL DEFAULT NULL AFTER `updated`");
	Db::i()->query("UPDATE ?_lc_album_albums SET updated1=UNIX_TIMESTAMP(updated)");
	Db::i()->query("UPDATE ?_lc_album_images SET updated1=UNIX_TIMESTAMP(updated)");
	Db::i()->query("ALTER TABLE ?_lc_album_albums DROP `updated`");
	Db::i()->query("ALTER TABLE ?_lc_album_images DROP `updated`");
	Db::i()->query("ALTER TABLE ?_lc_album_albums CHANGE `updated1` `updated` INT( 10 ) UNSIGNED NULL DEFAULT NULL");
	Db::i()->query("ALTER TABLE ?_lc_album_images CHANGE `updated1` `updated` INT( 10 ) UNSIGNED NULL DEFAULT NULL");
}
