fixed database migration method
This commit is contained in:
parent
91d81bd943
commit
2716fe0432
@ -40,20 +40,23 @@ class MigrationHelper {
|
|||||||
|
|
||||||
$mysqli = $this->maniaControl->database->mysqli;
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
|
|
||||||
$query = "INSERT INTO `" . SettingManager::TABLE_SETTINGS . "` (`class`, `setting`, `type`, `value`, `default`)
|
$query = "INSERT IGNORE INTO `" . SettingManager::TABLE_SETTINGS . "`
|
||||||
SELECT ?, `setting`, `type`, `value`, `default` FROM `" . SettingManager::TABLE_SETTINGS . "` WHERE `class` = ?;";
|
(`class`, `setting`, `type`, `value`, `default`)
|
||||||
|
SELECT ?, `setting`, `type`, `value`, `default`
|
||||||
|
FROM `" . SettingManager::TABLE_SETTINGS . "`
|
||||||
|
WHERE `class` = ?;";
|
||||||
$statement = $mysqli->prepare($query);
|
$statement = $mysqli->prepare($query);
|
||||||
if ($mysqli->error) {
|
if ($mysqli->error) {
|
||||||
trigger_error($mysqli->error);
|
trigger_error($mysqli->error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$statement->bind_param('ss', $targetClass, $sourceClass);
|
$statement->bind_param('ss', $targetClass, $sourceClass);
|
||||||
|
$success = $statement->execute();
|
||||||
if ($statement->error) {
|
if ($statement->error) {
|
||||||
trigger_error($statement->error);
|
trigger_error($statement->error);
|
||||||
$statement->close();
|
$statement->close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$success = $statement->execute();
|
|
||||||
$statement->close();
|
$statement->close();
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user