5
votes

I'm developing a system with database version control in LiquiBase. The system is still in pre-alpha development and there are a lot of changes that were reverted or supplemented by other changes (tables removed, columns added and removed).

The current change set reflects the whole development history with many failed experiments, and this whole is rollouted when initializing the database.

Because there is NO release version, I can start from scratch and pull actual DB state in single XML changeset.

Is there a way to tell LiquiBase to merge all change sets into one file, or the only way to do that is per hand?

2
afaik liquibase doesn't have function for this...you have to merge the changesets manually. - bilak

2 Answers

6
votes

Just use your existing database to generate change log that will be used from now on. For this you can use generateChangeLog command from command line, it will generate the changelog file with all the changeSets that represent your current state of the database. You can use this file in your project as initial db creation file, to be used on an empty database. Here's a link to docs.

3
votes

There is a page in the Liquibase docs which discusses this scenario in detail: http://www.liquibase.org/documentation/trimming_changelogs.html

To summarise, they recommend that you don't bother since consolidating your changelogs is both risky and low-reward.

If you do want to push ahead with this, then restarting the changelog using generateChangeLog, as suggested by @veljkost, is probably the easiest way. This is documented at http://www.liquibase.org/documentation/existing_project.html