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

Commit

Permalink
fix(sql): retrieve contact_js_effects to avoid mbi generation failure (
Browse files Browse the repository at this point in the history
  • Loading branch information
kduret committed Dec 21, 2021
1 parent 9ea2a6c commit 11c0f01
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/clapi_export/clapi-configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ ENGINECFG;setparam;Centreon Engine Central;broker_module;/usr/lib64/centreon-eng
CONTACTTPL;ADD;contact_template;contact_template;;md5__d41d8cd98f00b204e9800998ecf8427e;0;1;;local
CONTACTTPL;setparam;contact_template;hostnotifopt;n
CONTACTTPL;setparam;contact_template;servicenotifopt;n
CONTACTTPL;setparam;contact_template;contact_js_effects;0
CONTACTTPL;setparam;contact_template;timezone;0
CONTACTTPL;setparam;contact_template;reach_api;0
CONTACTTPL;setparam;contact_template;reach_api_rt;0
Expand All @@ -620,6 +621,7 @@ CONTACTTPL;setparam;contact_template;enable_one_click_export;0
CONTACTTPL;ADD;test_name;test_contact-template;;md5__b0e52a1510c9012ebae9e9dc1ae0c46e;0;1;;local
CONTACTTPL;setparam;test_contact-template;hostnotifopt;n
CONTACTTPL;setparam;test_contact-template;servicenotifopt;n
CONTACTTPL;setparam;test_contact-template;contact_js_effects;0
CONTACTTPL;setparam;test_contact-template;timezone;0
CONTACTTPL;setparam;test_contact-template;reach_api;0
CONTACTTPL;setparam;test_contact-template;reach_api_rt;0
Expand All @@ -635,6 +637,7 @@ CONTACT;setparam;admin;hostnotifperiod;24x7
CONTACT;setparam;admin;svcnotifperiod;24x7
CONTACT;setparam;admin;hostnotifopt;n
CONTACT;setparam;admin;servicenotifopt;n
CONTACT;setparam;admin;contact_js_effects;0
CONTACT;setparam;admin;timezone;0
CONTACT;setparam;admin;reach_api;0
CONTACT;setparam;admin;reach_api_rt;0
Expand All @@ -652,6 +655,7 @@ CONTACT;setparam;guest;hostnotifperiod;24x7
CONTACT;setparam;guest;svcnotifperiod;24x7
CONTACT;setparam;guest;hostnotifopt;n
CONTACT;setparam;guest;servicenotifopt;n
CONTACT;setparam;guest;contact_js_effects;0
CONTACT;setparam;guest;timezone;0
CONTACT;setparam;guest;reach_api;0
CONTACT;setparam;guest;reach_api_rt;0
Expand All @@ -667,6 +671,7 @@ CONTACT;setparam;guest;svcnotifcmd;service-notify-by-email
CONTACT;ADD;Jean-Pierre;jeanpierre;Jean-Pierre@hotmail.fr;md5__d41d8cd98f00b204e9800998ecf8427e;0;1;browser;local
CONTACT;setparam;jeanpierre;hostnotifopt;n
CONTACT;setparam;jeanpierre;servicenotifopt;n
CONTACT;setparam;jeanpierre;contact_js_effects;0
CONTACT;setparam;jeanpierre;timezone;0
CONTACT;setparam;jeanpierre;reach_api;0
CONTACT;setparam;jeanpierre;reach_api_rt;0
Expand All @@ -680,6 +685,7 @@ CONTACT;setparam;jeanpierre;enable_one_click_export;0
CONTACT;ADD;test_contact;test_contact;test@localhost;md5__b0e52a1510c9012ebae9e9dc1ae0c46e;0;0;en_US.UTF-8;local
CONTACT;setparam;test_contact;hostnotifopt;n
CONTACT;setparam;test_contact;servicenotifopt;n
CONTACT;setparam;test_contact;contact_js_effects;0
CONTACT;setparam;test_contact;timezone;0
CONTACT;setparam;test_contact;reach_api;0
CONTACT;setparam;test_contact;reach_api_rt;0
Expand All @@ -695,6 +701,7 @@ CONTACT;setparam;user;hostnotifperiod;24x7
CONTACT;setparam;user;svcnotifperiod;24x7
CONTACT;setparam;user;hostnotifopt;n
CONTACT;setparam;user;servicenotifopt;n
CONTACT;setparam;user;contact_js_effects;0
CONTACT;setparam;user;timezone;0
CONTACT;setparam;user;reach_api;0
CONTACT;setparam;user;reach_api_rt;0
Expand Down
1 change: 1 addition & 0 deletions www/install/createTables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ CREATE TABLE `contact` (
`contact_address5` varchar(200) DEFAULT NULL,
`contact_address6` varchar(200) DEFAULT NULL,
`contact_comment` text,
`contact_js_effects` enum('0','1') DEFAULT '0',
`contact_location` int(11) DEFAULT '0',
`contact_oreon` enum('0','1') DEFAULT NULL,
`reach_api` int(11) DEFAULT '0',
Expand Down
31 changes: 31 additions & 0 deletions www/install/php/Update-21.10.2.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,34 @@
* For more information : contact@centreon.com
*
*/

include_once __DIR__ . "/../../class/centreonLog.class.php";
$centreonLog = new CentreonLog();

//error specific content
$versionOfTheUpgrade = 'UPGRADE - 21.10.2: ';

/**
* Query with transaction
*/
try {
$errorMessage = 'Impossible to add "contact_js_effects" column to "contact" table';

if (!$pearDB->isColumnExist('contact', 'contact_js_effects')) {
$pearDB->query(
"ALTER TABLE `contact`
ADD COLUMN `contact_js_effects` enum('0','1') DEFAULT '0'
AFTER `contact_comment`"
);
}
} catch (\Exception $e) {
$centreonLog->insertLog(
4,
$versionOfTheUpgrade . $errorMessage .
" - Code : " . (int)$e->getCode() .
" - Error : " . $e->getMessage() .
" - Trace : " . $e->getTraceAsString()
);

throw new \Exception($versionOfTheUpgrade . $errorMessage, (int)$e->getCode(), $e);
}

0 comments on commit 11c0f01

Please sign in to comment.