And again I spoke too soon. Any change I attempt, be it columnnames or constraintnames are resulting in a NPE.
And again I spoke too soon. Any change I attempt, be it columnnames or constraintnames are resulting in a NPE.
This occurs for every check on any kind of constraint using (at least) the modifier. This sounds like a bug to me.
I’m working with mysql 5.1
I ran into trouble trying to execute a precondition check for existence of a foreign key. I’m not sure if it due to bad config on my side or a bug.
The xml entry:
<addForeignKeyConstraint
constraintName=“FK_COM_REPORT_DEFINITION”
baseTableName=“COM_REPORT_EXECUTION” baseColumnNames=“COM_REPORT_DEFINITION_FK”
referencedTableName=“COM_REPORT” referencedColumnNames=“report_pk”
onDelete=“CASCADE”
/>
The stacktrace:
SEVERE 4/14/12 8:31 AM:liquibase: Change Set src/main/resources/database/changelogs/ddl/liquibase-core-COM_REPORT_EXECUTION.xml::3-ADD_FOREIGN_KEY_FOR_DEFINITIONS::wvd failed. Error: null
java.lang.NullPointerException
at liquibase.snapshot.jvm.MySQLDatabaseSnapshotGenerator.getColumnTypeAndDefValue(MySQLDatabaseSnapshotGenerator.java:114)
at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.readColumn(JdbcDatabaseSnapshotGenerator.java:202)
at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.readColumns(JdbcDatabaseSnapshotGenerator.java:335)
at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot(JdbcDatabaseSnapshotGenerator.java:244)
at liquibase.snapshot.DatabaseSnapshotGeneratorFactory.createSnapshot(DatabaseSnapshotGeneratorFactory.java:69)
at liquibase.precondition.core.ForeignKeyExistsPrecondition.check(ForeignKeyExistsPrecondition.java:52)
at liquibase.precondition.core.NotPrecondition.check(NotPrecondition.java:30)
at liquibase.precondition.core.AndPrecondition.check(AndPrecondition.java:34)
at liquibase.precondition.core.PreconditionContainer.check(PreconditionContainer.java:199)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:249)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
at liquibase.Liquibase.update(Liquibase.java:113)
at org.liquibase.maven.plugins.LiquibaseUpdate.doUpdate(LiquibaseUpdate.java:31)
at org.liquibase.maven.plugins.AbstractLiquibaseUpdateMojo.performLiquibaseTask(AbstractLiquibaseUpdateMojo.java:24)
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:302)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
INFO 4/14/12 8:31 AM:liquibase: Successfully released change log lock
INFO 4/14/12 8:31 AM:liquibase: Successfully released change log lock
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
Right… I solved the error by changing the config to:
Which means I need to specify the column name instead of the constraintname. It’s not entirely clear in the documentation but on the other hand I’m easily confused.
I committed a fix that should resolve the problem for 2.0.4
Nathan