Skip to main content

 

Hello everyone, I hope you're all doing well.

I'm following the How to write a module documentation to create a module in Centreon. Everything works fine except when trying to upgrade the module.

The documentation mentions that we should have an upgrade path like this: UPGRADE > dummy-x.x > sql > upgrade.sql.

I created an UPGRADE folder in /usr/share/centreon/www/modules/traps (module is named traps ) and inside it, I created traps-1.1 > sql > upgrade.sql. The upgrade.sql file contains an SQL query to create a table named test_v11 in the centreon_storage database.
In conf.php, I updated 'mod_release' from '1.0' to '1.1'. When I go to Extension > Manager, I see the update button.

However, when I click it, I receive an error.

I then renamed UPGRADE to upgrade, and when I clicked the update button again, the upgrade showed as successful, but the test_v11 table was not created.
​​​​​

I also tried updating conf.php to 'mod_release' => '1.2', and again, the update process showed as successful, even though I don’t have an hupgrade > traps-1.2] folder, which doesn’t make sense.

Has anyone successfully upgraded a custom-written module before? Any advice would be helpful.

Be the first to reply!

Reply