Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using liquibase on the existing database

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?

like image 540
yottabrain Avatar asked May 09 '13 06:05

yottabrain


People also ask

What is the advantage of using Liquibase?

Beyond the work of tracking the applied changes, other advantages liquibase would give you include: Ability to have the same change description on multiple database types. Ability to have if/then logic in what is applied. Generated documentation of database history.


1 Answers

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.
like image 113
a_horse_with_no_name Avatar answered Sep 19 '22 13:09

a_horse_with_no_name