lychee/php/database/update_030200.php

29 lines
843 B
PHP
Raw Normal View History

<?php
/**
2016-08-22 12:08:03 +00:00
* Update to version 3.2.0
*/
use Lychee\Modules\Database;
use Lychee\Modules\Response;
// Add parent field to albums
2016-07-31 13:53:34 +00:00
$query = Database::prepare($connection, "SELECT `parent` FROM `?` LIMIT 1", array(LYCHEE_TABLE_ALBUMS));
2016-08-22 12:08:03 +00:00
$result = Database::execute($connection, $query, "update_030200", __LINE__);
2016-07-31 13:53:34 +00:00
if ($result===false) {
$query = Database::prepare($connection, "ALTER TABLE `?` ADD `parent` BIGINT(14) NOT NULL DEFAULT 0", array(LYCHEE_TABLE_ALBUMS));
2016-08-22 12:08:03 +00:00
$result = Database::execute($connection, $query, "update_030200", __LINE__);
2016-07-31 13:53:34 +00:00
if ($result===false) {
2016-08-22 12:08:03 +00:00
Log::error($database, 'update_030200', __LINE__, 'Could not update database (' . $database->error . ')');
2016-07-31 13:53:34 +00:00
return false;
}
}
// Set version
2016-08-22 12:08:03 +00:00
// if (Database::setVersion($connection, '030200')===false) Response::error('Could not update version of database!');
?>