powered by Jive Software

Problem with deploying a plugin with multiple CustomDatabase-upgrades

Hello everybody,

I am currently developing a few openfire Plugins.

We got a staging server and a development server.

I recently did a lot of changes on the development system.

On the staging system the plugins database still is version 0… however, on the development system it is not version 4.

When I deployed the new plugin earlier today I noticed that the Database updates were not handled as expected.

I thought the plugin system would notice that the staging systems version is 0 and then perform the database upgrade starting at 1 -> 2 -> 3 and finally to 4.

What it did instead was to only use the upgrade script for version 4.

I had to manually add tables and triggers.

What is the best way to get this to work?

Thanks in advance.

Yes, the schema manager (via the plugin manager) will execute all your DB upgrade scripts in order, assuming they are present in your deployed plugin. The naming convention for the folder structure in your plugin folrder is …/src/database/upgrade/n/ where n is the version number(s), beginning with 1. In each of these folders, your DB upgrade script must match the following pattern:

{plugin}_{dbtype}.sql

where {plugin} is the schema name for your plugin (from the element in your plugin.xml), and {dbtype} matches the target database type (e.g. “mysql”).

Thanks for your reply. Thats exactly what I am doing.

However, it seems that only the latest “upgrade/n” -Script is executed when installing the plugin.