How to upgrade plugin tables?

Hi there,

I don’t know how to update the plugin tables ?

The method install() of the “PluginName.php” main file doesn’t do that…
And there is nothing about that on Piwik\Plugin.php !

So my new plugin version is not working 'cause it can’t update its database itself.

Is there anything already done on this subject ?

Cheers,
Vincent.

Here is my solution :

A DB versioning Class management.

It triggers on \Piwik\Plugin()->postLoad(), so basically on every page load, which is not very efficient.
If someday you come to implement an update() method in \Piwik\Plugin, that could be great! :wink:

This feature iss built-in the Piwik plugin framework of course :slight_smile:

Please see an example in the CustomAlerts plugin: plugin-CustomAlerts/Updates at master · matomo-org/plugin-CustomAlerts · GitHub

You can define schema updates and it’s based off the plugin version defined in plugin.json

hope it helps and you can use that instead of your temporary solution :slight_smile:

Haaaa no way!!

That was such a waste of time x) looks so good !