fixed database migration method

This commit is contained in:
Steffen Schröder 2014-05-04 00:33:49 +02:00
parent 91d81bd943
commit 2716fe0432

View File

@ -40,20 +40,23 @@ class MigrationHelper {
$mysqli = $this->maniaControl->database->mysqli;
$query = "INSERT INTO `" . SettingManager::TABLE_SETTINGS . "` (`class`, `setting`, `type`, `value`, `default`)
SELECT ?, `setting`, `type`, `value`, `default` FROM `" . SettingManager::TABLE_SETTINGS . "` WHERE `class` = ?;";
$query = "INSERT IGNORE INTO `" . SettingManager::TABLE_SETTINGS . "`
(`class`, `setting`, `type`, `value`, `default`)
SELECT ?, `setting`, `type`, `value`, `default`
FROM `" . SettingManager::TABLE_SETTINGS . "`
WHERE `class` = ?;";
$statement = $mysqli->prepare($query);
if ($mysqli->error) {
trigger_error($mysqli->error);
return false;
}
$statement->bind_param('ss', $targetClass, $sourceClass);
$success = $statement->execute();
if ($statement->error) {
trigger_error($statement->error);
$statement->close();
return false;
}
$success = $statement->execute();
$statement->close();
return $success;
}