Migrating to 2.0-RC2-SNAPSHOT: Error creating DATABASECHANGELOG with latest src

Hi,

I’ve just tried to migrate from 1.9.5 to 2.0-RC2-SNAPSHOT. I’ve to use hsqldb-2.0, and the double IDENTITY pb forces me tu upgrade.

I can’t find a replacement for SpringLiquibase unfortunately, so I’ve temporarly used liquibase-maven plugin to get a database setup before my tests.

I get the following error which seems to be internal to Liquibase:

Jun 23, 2010 6:19:42 PM liquibase.logging.jvm.JavaUtilLogger info
INFO: Successfully acquired change log lock
Jun 23, 2010 6:19:42 PM liquibase.logging.jvm.JavaUtilLogger info
INFO: com/company/client/project/db.changelog.initial.xml is using schema version 1.9 rather than version 2.0
Jun 23, 2010 6:19:44 PM liquibase.logging.jvm.JavaUtilLogger info
INFO: Successfully released change log lock
[ERROR] Error executing SQL ALTER TABLE DATABASECHANGELOG ALTER COLUMN  EXECTYPE VARCHAR(10) NOT NULL
liquibase.exception.DatabaseException: Error executing SQL ALTER TABLE DATABASECHANGELOG ALTER COLUMN  EXECTYPE VARCHAR(10) NOT NULL
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:61)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:92)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:69)
at liquibase.database.AbstractDatabase.checkDatabaseChangeLogTable(AbstractDatabase.java:415)
at liquibase.Liquibase.checkDatabaseChangeLogTable(Liquibase.java:523)
at liquibase.Liquibase.forceReleaseLocks(Liquibase.java:559)
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.cleanup(AbstractLiquibaseMojo.java:415)
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:291)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.sql.SQLException: Attempt to insert null into a non-nullable column: column: EXECTYPE table: DATABASECHANGELOG in statement [ALTER TABLE DATABASECHANGELOG ALTER COLUMN  EXECTYPE VARCHAR(10) NOT NULL]
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.execute(Unknown Source)
at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:83)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:54)
… 26 more
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error setting up or running Liquibase: Error executing SQL UPDATE DATABASECHANGELOG SET ORDEREXECUTED = -1

Violation of unique constraint UQ_LB_ORDEREXEC: duplicate value(s) for column(s) ORDEREXECUTED

regards,
nodje

Hi,

I’ve got this working now, at least with hsqldb-1.8.

I still have a problem in replacing SpringLiquibase with Liquibase-Maven:

it doesn’t seem to work with an in-memory database. It seems the database is destroyed after the execution of the Maven phase.
I use the following config:

           
                org.liquibase
                liquibase-maven
                2.0-rc2-SNAPSHOT
               
                    true
                    src/test/resources/liquibase.properties
               
               
                   
                        test-compile
                       
                            update
                       
                   
               
           

Am I making some mistake or is this just not compatible with an in-memory DB?

regards

I’m not sure how the maven process works.  If it forks a new java process, or uses a different classloader for the liquibase-maven plugin compared to the rest of your application, the hsql instances will be different.  I think there is a way to tell hsql to use a persistant database rather than purely in-memory.  That should help.

I’ll look into why it’s failing in hsql 2.0.

Nathan

Nathan,

I think it’d be good to keep the Spring option to integrate Liquibase into an application.

There’s many situation where you don’t want to bother with Maven. Here’s a few I can remember from the top of my head:

  • when you just want to run a test within your IDE
  • when you deploy your app in production/test environment, you want Liquibase to update the db, but usually you just provide a WAR, not a Maven command.

and maybe when you want to use a faster in-memory DB!

SpringLiquibase was quite a good start IMHO, just needed a few more options. Is it really out in 2.0?

best

It is still in there.  I see the package had changed to liquibase.jvm.integration.spring.SpringLiquibase.  I will commit a change to move it to liquibase.integration.spring.SpringLiquibase.  Was that what it was before?

Nathan

Before it was liquibase.spring.SpringLiquibase

thanks for the pointer.
nodje