upgrade existing db project 1.9 => 2.0

Hi,
definitely I skipped a how-to upgrade existing 1.9 project to version 2.0

    Trying to launch 2.0 over 1.9 database liquibase throws exception (launched under maven 2.2.0)

    …trunk\mischung-dbupdate\mischung>mvn package
    [INFO] Scanning for projects…
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Update Mischung db
    [INFO]    task-segment: [package]
    [INFO] ------------------------------------------------------------------------
    [INFO] [resources:resources {execution: default-resources}]
    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 52 resources
    [INFO] [compiler:compile {execution: default-compile}]
    [INFO] Nothing to compile - all classes are up to date
    [INFO] [liquibase:updateSQL {execution: generate-step}]
    [INFO] ------------------------------------------------------------------------
    [INFO] there are no resolved artifacts for the Maven project.
    [INFO] Output SQL Migration File: C:\dev\reckitt\MischungAppl\trunk\mischung-dbupdate\mischung\target\liquibase\migrate.sql
    [INFO] Executing on Database: jdbc:jtds:sqlserver://localhost:1433;DatabaseName=mischung
    18.09.2009 12:23:59 liquibase.logging.JavaUtilLogger info
    INFO: Successfully acquired change log lock
    18.09.2009 12:23:59 liquibase.logging.JavaUtilLogger warning
    WARNUNG: C:/dev/reckitt/MischungAppl/trunk/mischung-dbupdate/mischung/target/classes/changeset-mischung.xml is using schema version 1.9 rather than version 2.0
    18.09.2009 12:24:00 liquibase.logging.JavaUtilLogger info
    INFO: Reading from [dbo].[DATABASECHANGELOG]
    18.09.2009 12:24:00 liquibase.logging.JavaUtilLogger info
    INFO: Successfully released change log lock
    18.09.2009 12:24:00 liquibase.logging.JavaUtilLogger info
    INFO: Successfully released change log lock
    18.09.2009 12:24:00 liquibase.logging.JavaUtilLogger info
    INFO: Successfully released change log lock
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] Error setting up or running Liquibase: Error executing SQL SELECT FILENAME,AUTHOR,ID,MD5SUM,DATEEXECUTED,ORDEREXECUTED,TAG FROM [dbo].[DATABASECHANGELOG] ORDER B
    Y DATEEXECUTED ASC, ORDEREXECUTED ASC

    Invalid column name ‘ORDEREXECUTED’.
    [INFO] ------------------------------------------------------------------------
    [INFO] For more information, run Maven with the -e switch
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3 seconds
    [INFO] Finished at: Fri Sep 18 12:24:00 GMT+01:00 2009
    [INFO] Final Memory: 8M/15M
    [INFO] ------------------------------------------------------------------------

It would be nice to be pointed how to troubleshoot the issue .

Cheers, Oleg

Probably because there is not howto for upgrading to 2.0 yet :slight_smile:

We are still working on 2.0, it is just in beta3, and so we have not yet finalized or documented how the upgrade process works. I added some checks that should have upgraded your database.  What version of 2.0 are you running?  The latest from trunk?

Nathan

The method that should upgrade the table is AbstractDatabase.checkDatabaseChangeLogTable()

Yes, I’m using the trunk version.

One more suggestion. Add a maven/ant/liqubase tasks to do such upgrading convenient.
I’m not sure if should be done automatically. The best way - do manually, optionally with generating SQL script (as updateSQL task)
Name of the new task?
liquibaseUpgrade, or simple ‘upgrade’, parameters currentVersion, targetVersion.
What about downgrade? It would be super, if not tedious, of course.

It will help protect investment in the liquibase and robustness of the program.

I think doing an automatic upgrade is the better option.  There are times (such as having liquibase run as part of application startup as a servlet listener) that you can’t expect people to know when to do an “upgrade” command vs. a regular update.  Plus, if it is automatic and transparent, it will save me from having to write more of a howto guide :slight_smile:

The automatic upgrade was working at one point, I’ll have to look into why it is not now.

Nathan 

The upgrade guide at http://www.liquibase.org/v2_upgrade oes not specify how to upgrade. In particular: If I have a series of changelogs in 1.9 format (which have not been applied), will these be processed correctly by 2.0 ?

If so, this is my suggestion to add to the upgrade guide:

Upgrade Process

To upgrade, start creating the new changelogs in 2.0 format. At the first run of the 2.0 version of Liquibase, the existing checksums in the DATABASECHANGELOG table will be upgraded. Subsequently the changelogs will be applied. Any existing changelogs in 1.9 format will successfully be processed by 2.0.

If the above is not correct, then what is the procedure?

You should be able to leave your changelogs in 1.9 format.  The XML format is the same, with the only difference being the lack of the modifyColumn change and any new features in 2.0. 

For most people, you should be able to just replace the jar file and it will work as expected.  I’ll make sure tho describe the checksum changes better, though. 

Nathan