0

I'm learning Jenkins and liquibase. I am integrating it into a java project made with maven.

In my particular case, once a version of the application is released to the client, the application is delivered with the SQL script to update the database. I can not deliver a changelog file to update with liquibase, many times the client wants to see exactly what changes are made to their database.

I have created in Jenkins a pipeline where every time a Tag is created with the version of the app, it is downloaded from git, compiled, saved the compiled binary in the cloud, and then updated the test environment. This works great.

Now in my particular case is going to come the client and will say: "I have installed version 1.3 of the application, and I want to install the 2.0." I have to be able to give you the SQL scripts to update your database. What would be the best way to solve this with liquibase? Does anyone have any advice for this? Do you know of any other tools for this? Sorry for my English.

user60108
  • 3,270
  • 2
  • 27
  • 43

1 Answers1

2

Use SQL Output via maven updateSQL goal.

If you organize your changeSets like this:

db.changelog.xml (all changeSets)
release1 (folder)
db.r1.changelog.xml (release1 changeSets)
db.r1.changeset1.xml
db.r1.changeset2.xml
...
release2 (folder)
db.r2.changelog.xml (release2 changeSets)
db.r2.changeset1.xml
db.r2.changeset2.xml
...

You can generate a SQL script to update your database from release1 to release2 using de following maven command:

mvn liquibase:updateSQL 
-Dliquibase.changeLogFile=db.r2.changelog.xml 
-Dliquibase.properties=your-project.properties
Fernando Costa
  • 669
  • 1
  • 9
  • 31