问题
We have a existing database in production. We have decided to use liquibase for all further updates and create any new database (like development or integration).
We have created liquibase scripts based on the existing production schema (to create any new database like development, integration, etc). On top of that script we have also added two more updates. Going forward all further updates to production DB will be done by liquibase.
If we execute the liquibase on production, it will try do all the complete changes even those which are already exist, which should not happen as production already has everything except the two new updates. Now we want to use the liquibase to update those two changes alone to productions.
How we can do this?
回答1:
The process to put a existing database under liquibase control is the following:
- Create the initial changelog (that's what you did)
- Run liquibase using the command
changelogSync
. This will create the Liquibase tables and mark all change sets as being applied (this is what you missed) - Add your change sets
- Run liquibase using the command
update
to apply the change sets.
来源:https://stackoverflow.com/questions/16455624/using-liquibase-on-the-existing-database