Dbdeploy maven plugin not finding changelog table

1.8k views Asked by At

I'm using the dbdeploy maven plugin but it's throwing an error when I run a build. The error says :

 [ERROR] com.dbdeploy.exceptions.SchemaVersionTrackingException: Could not retrieve change log from database because: user lacks privilege or object not found: CHANGELOG

This is because the CHANGELOG table that dbdeploy uses has not been created. I can see how it is done using the ant build script that comes with the examples, but I can't figure out how to get it done with the maven plugin (I don't want to run an ant task under maven, that defeats the point of the dbdeploy-maven-plugin).

Any ideas?

2

There are 2 answers

0
Dave Richardson On BEST ANSWER

Having trawled through the dbdeploy source and the dbdeploy maven plugin source I can't see anywhere that the changelog is being created. The example that comes bundled with the code does not work, I get the impression that it is a half finished and poorly tested effort.

I manually create the changelog table and things worked after that, but that is a poor solution.

Thankfully, though too late for me, I eventually discovered someone else who had the same problem, their solution is here. In short, they run the script for creating the changelog by invoking the maven sql plugin.

None of this is documented in the dbdeploy site, I'll probably look at alternatives given that this all feels a bit flakey.

1
Raghuram On

Running the following command as documented in the Using Maven Plugin page...

mvn help:describe -Dplugin=com.dbdeploy:maven-dbdeploy-plugin -Ddetail

we see the following goal, which helps generate the changelog

dbdeploy:change-script
  Description: Maven goal for creating a new timestamped dbdeploy change
    script.
  Implementation: com.dbdeploy.mojo.CreateChangeScriptMojo
  Language: java

  Available parameters:

    name (Default: new_change_script)
      Expression: ${dbdeploy.script.name}
      Name suffix for the file that will be created (e.g.
      add_email_to_user_table).

    scriptdirectory (Default: ${project.src.directory}/main/sql)
      Expression: ${dbdeploy.scriptdirectory}
      Directory where change scripts reside.

So I guess we would run this prior to the other goals like db-scripts and update.