Generate SQL up to a specified tag


first of all: Thanks for LiquiBase :slight_smile:

I am trying to retrofit LiquiBase onto a project and I am not quite sure how to use it properly to fit my development model:


I have a project that already had 4 releases. The thing is pretty old and so far all db changes have been made manually (irks). Basically I want to generate two SQL files for for each release called “release_xyz_update.sql” and “release_xyz_rollback.sql”. I don’t have direct access to the database via LiquiBase. Only to a development database. This is why I need the SQL files. Thanks to the SQL output this should be no problem.

My idea is as following: For every release-cycle I’ll use a folder containing all changesets required for the release. The changelog will then be as follows:

    include r1/* tag r1 include r2/* tag r2


1.) Does this model make sense or do you see some problem with that for future development (Speaking from experience)?

2.) I’ve gone so far to recreate the releases done so far by studing README.release files and can now update to the latest schema using LiquiBase update. Now I wanted to generate the SQL files for the releases done without LiquiBase. Is there a way I can do that? And only generate the update SQL up to a specific tag? I didn’t find anything about that in the documentation. My idea for now is to just comment out parts of the changelog and generate the SQL files incrementally but since there are a few more projects I’ll have to migrate after this one (with the same problem) I wondered if there’s an automated solution for this

Thanks so much,

(sorry for the slow response)

Your setup looks like it will make work fine.  Your future changes will be made initially in liquibase?  That is what usually works the best.

There is an updateSQL mode where liquibase will generate the SQL that needs to ran to get a given database up to date without actually executing it.  That SQL can than be ran on a production database after being tested locally (and possibly inspected and improved by dbas).  The updateSQL doesn’t support generating up to a given tag, though.  The way tags are normally used is to set a point that was executed for later rollback.  For generating SQL getting liquibase going, your commenting out approach will probably make the most sense.