Using liquibase on the existing database

做~自己de王妃 提交于 2020-07-31 09:45:53

问题


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:

  1. Create the initial changelog (that's what you did)
  2. 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)
  3. Add your change sets
  4. Run liquibase using the command update to apply the change sets.


来源:https://stackoverflow.com/questions/16455624/using-liquibase-on-the-existing-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!