Plugin- Openfire must restart for correct database schema version

When installing my plugin, the first time Openfire loads my plugin only the version 0 of the sql scripts get executed. In the Openfire console I see the message “Missing database schema for plugin23. Attempting to install… Database update successful.”

Once Openfire is restarted I get the following message in the Openfire console “Found old database schema for plugin23. Upgrading to version 1… Database update successful.” After that everything seems to work fine. I’m just trying to avoid people having to restart openfire to get my plugin to work correctly.

Here is my Plugin directory structure:

Plugin23 Root ( resides in Openfire\Plugins)
¦
±–database (contains plugin23_hsqldb.sql)
¦ ±–upgrade
¦ ±–1 (contains plugin23_hsqldb.sql)
¦
±–lib
¦
±–web
±–WEB-INF

My Plugin.xml contains:

1

And here are the sql scripts:

Version 0

CREATE CACHED TABLE Action (
identifier VARCHAR(200) NOT NULL,
name VARCHAR(200),
description VARCHAR(200),
CONSTRAINT Action_pk PRIMARY KEY (roomID)
);

INSERT INTO jiveVersion (name, version) VALUES (‘plugin23’, 0);

Version 1

CREATE CACHED TABLE chat23(
identifier VARCHAR(200) NOT NULL,
roomID VARCHAR(200) NOT NULL,
XMLblob LONGVARCHAR NOT NULL,
type VARCHAR(200) NOT NULL,
CONSTRAINT chat23_pk PRIMARY KEY (identifier)
);

// Finally, insert default table values.
UPDATE jiveVersion set version=‘1’ where name=‘plugin23’;

Thanks in advance for any help,

Chris

database/plugin23_hsqldb.sql is used for install, so place there a script that directly applys version 1.

Do I need to place the original script in database/upgrade/0/plugin23_hsqldb.sql ?

Thanks,

Chris

No, because the user will already have it in his database. Otherwise you could directly install the current version.