Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

fix(db): change type of notification_number column 21.10 #11935

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions www/install/php/Update-21.10.11.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,22 @@
try {
$errorMessage = "Impossible to update 'hosts' table";
if (! str_contains(strtolower($pearDBO->getColumnType('hosts', 'notification_number')), 'bigint')) {
$pearDBO->beginTransaction();
$pearDBO->query("UPDATE `hosts` SET `notification_number`= 0 WHERE `notification_number`< 0");
$pearDBO->query("ALTER TABLE `hosts` MODIFY `notification_number` BIGINT(20) UNSIGNED DEFAULT NULL");
}

$errorMessage = "Impossible to update 'services' table";
if (! str_contains(strtolower($pearDBO->getColumnType('services', 'notification_number')), 'bigint')) {
$pearDBO->beginTransaction();
$pearDBO->query("UPDATE `services` SET `notification_number`= 0 WHERE `notification_number`< 0");
$pearDBO->query("ALTER TABLE `services` MODIFY `notification_number` BIGINT(20) UNSIGNED DEFAULT NULL");
}
} catch (\Exception $e) {
if ($pearDBO->inTransaction()) {
$pearDBO->rollBack();
}

$centreonLog->insertLog(
4,
$versionOfTheUpgrade . $errorMessage .
Expand Down