generateChangelog - useful extension would be to add an option "addPreconditions"

We have a situation where we wish to replace a large set of old scripts with liquibase. The old scripts may or may not have been executed, and we want it to be possible to run only liquibase in both situations.

While the generateChangelog command makes it quite easy to get the new changelogs in place, the work of adding preconditions to all changesets in order to handle both situations is a cumbersome manual process. And it should not really be necessary. I think it would be a good idea to add an option addPreconditions to this method. If the option is used, every createTable changeset should have a not tableExists precondition for the table, with onFail: MARK_RAN. And so on, for the other object types.

I hope such a feature could be added!

Edit: I noticed that you ask for feature requests to be added as an issue in github, so I have registered the following issue for this: feature request: generateChangelog option "addPreconditions" · Issue #4950 · liquibase/liquibase · GitHub

I know you said “may or may not have been executed” but the changelog-sync command is used to record a set of changesets as executed, which is similar to your situation.

Unfortunately, that is not at all useful in our situation.

We have a number of customers whose database may be at different levels. We want all of them, regardless of what is previously installed, to be able to switch to liquibase and install “everyting”.