Changeset 3122


Ignore:
Timestamp:
Feb 8, 2007, 12:11:13 PM (16 years ago)
Author:
Martin Svensson
Message:

Fixes #487. Update script must check the schema version before trying to update.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.1/src/core/net/sf/basedb/core/HibernateUtil.java

    r2898 r3122  
    440440      if (update)
    441441      {
     442        int currentSchemaVersion = Application.getSchemaVersion();       
     443        if (currentSchemaVersion < 0)
     444        {
     445          throw new BaseException("Couldn't load current schema version of database");
     446        }
     447        else if (Install.NEW_SCHEMA_VERSION < currentSchemaVersion)
     448        {
     449          throw new BaseException("Can't update to schema version " + Install.NEW_SCHEMA_VERSION +
     450              " of database, cause you already have schema version " + currentSchemaVersion + " installed");
     451        }
    442452        // Note! This doesn't create indexes correctly. Use dbIndexes method.
    443453        SchemaUpdate se = new SchemaUpdate(cfg);
Note: See TracChangeset for help on using the changeset viewer.