Opened 16 years ago

Closed 16 years ago

#487 closed defect (fixed)

Update script must check the schema version before trying to update

Reported by: Nicklas Nordborg Owned by: everyone
Priority: critical Milestone: BASE 2.2.1
Component: install Version: 2.2
Keywords: Cc:

Description (last modified by Nicklas Nordborg)

If the schema version is higher than expected the update script must stop. This would happen if trying to run the update script from a previous release. See mailing list for more info:

Change History (3)

comment:1 Changed 16 years ago by Nicklas Nordborg

Description: modified (diff)

comment:2 Changed 16 years ago by Nicklas Nordborg

I checked the code and the first place to check the schema version is in the HibernateUtil?.createStaticTables() method. The call sequence for an install/update is:


The HibernateUtil?.createStaticTables() method already checks if the database is emtpy or not. It should not be too difficult to add a check in the "if (update)" part to check the schema version. I think it is safe to use the Application.getSchemaVersion() method to find out the current schema version. Compare the value against the Install.NEW_SCHEMA_VERSION constant. If the NEW_SCHEMA_VERSION is lower than the current schema version the update should stop. Make sure to handle the case where Application.getSchemaVersion() returns -1 (in which case the update should also stop).

comment:3 Changed 16 years ago by Martin Svensson

Resolution: fixed
Status: newclosed

(In [3122]) Fixes #487. Update script must check the schema version before trying to update.

Note: See TracTickets for help on using tickets.