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

Commit

Permalink
fixed issue with negative notification_numbers during update (#11936)
Browse files Browse the repository at this point in the history
Co-authored-by: dmyios <diosypenko@centreon.com>

Refs: MON-15318
  • Loading branch information
kduret authored Oct 5, 2022
1 parent 4c90952 commit 2ec0743
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions www/install/php/Update-22.04.6.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

0 comments on commit 2ec0743

Please sign in to comment.