Opened 18 years ago
Closed 18 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 )
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:
http://sourceforge.net/mailarchive/forum.php?thread_id=31614751&forum_id=12992
Change History (3)
comment:1 by , 18 years ago
Description: | modified (diff) |
---|
comment:2 by , 18 years ago
comment:3 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
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).