Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

generateChangeLog (MySQL) does not work with cross schema foreign keys?

$
0
0
We're using MySQL 5.5 and a database designed with mysql workbench.

We have defined multiple schema's with tables inside them ofcourse.

tables in the schema's can have foreign keys to another schema's table.

I'm using maven to run liquibase:

<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<changeLogFile>src/com/metaregistrar/liquibase/changelog.xml</changeLogFile>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/mr_domains</url>
<username>${liquibase.user}</username>
<password>${liquibase.password}</password>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>


And then from command line:

mvn -X resources:resources liquibase:generateChangeLog

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.1.1:generateChangeLog (default-cli) on project metaregistrar: Execution default-cli of goal org.liquibase:liquibase-maven-plugin:3.1.1:generateChangeLog failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.liquibase:liquibase-maven-plugin:3.1.1:generateChangeLog (default-cli) on project metaregistrar: Execution default-cli of goal org.liquibase:liquibase-maven-plugin:3.1.1:generateChangeLog failed.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
        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:320)
        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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        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)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.liquibase:liquibase-maven-plugin:3.1.1:generateChangeLog failed.
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: java.lang.NullPointerException
        at liquibase.diff.output.changelog.core.MissingForeignKeyChangeGenerator.fixMissing(MissingForeignKeyChangeGenerator.java:42)
        at liquibase.diff.output.changelog.ChangeGeneratorChain.fixMissing(ChangeGeneratorChain.java:44)
        at liquibase.diff.output.changelog.ChangeGeneratorFactory.fixMissing(ChangeGeneratorFactory.java:95)
        at liquibase.diff.output.changelog.DiffToChangeLog.generateChangeSets(DiffToChangeLog.java:143)
        at liquibase.diff.output.changelog.DiffToChangeLog.print(DiffToChangeLog.java:124)
        at liquibase.diff.output.changelog.DiffToChangeLog.print(DiffToChangeLog.java:62)
        at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:118)
        at org.liquibase.maven.plugins.LiquibaseGenerateChangeLogMojo.performLiquibaseTask(LiquibaseGenerateChangeLogMojo.java:85)
        at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:377)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        ... 20 more

If I change the jdbc url to not include a catalog name the generateChangeLog doesn't output any revisions at all.

If I change the jdbc url to the simplest schema inside our database it only generates for that schema. I don't want that. There's like 10 schema's I need as 1 changelog. These schema's are working together and can't stand alone without each other.

I'm willing to provide the .sql to create the entire database structure to reproduce this problem. But not through public channels.


Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>