Liquibase Developer Workflow
Let's go through the entire developer workflow from beginning to end!
On your local development machine, add new changesets to your changelog. The changes are your choice to make.
liquibase update to apply the changes to the developer database. Iterate until you are happy with the final state.
liquibase --url=jdbc:h2:tcp://localhost:9090/mem:integration status --verbose
Running the command in step 3 allows you to see that the integration database has changesets that were not applied.
It is always best practice to know what changes are going to take place before saving and applying the changelog, especially if someone else edited or created the changelog.
liquibase --url=jdbc:h2:tcp://localhost:9090/mem:integration update-sql
Running the command in step 4 allows you to see exactly what SQL would run when running the
update command. You can also run a
diff command to compare the changes before saving and applying them.
To run the
diff command, run:
liquibase --url=jdbc:h2:tcp://localhost:9090/mem:dev --referenceUrl=jdbc:h2:tcp://localhost:9090/mem:integration --referenceUsername=dbuser --referencePassword=letmein diff
Save your changelog to source control, when you are happy with the changes that will be applied.
liquibase --url=jdbc:h2:tcp://localhost:9090/mem:integration update to apply the new changesets.
You can run the
diff commands again as way to see that all the changes have now been applied to integration.
That's the whole workflow! Now, start back at step 1 to continue iterating through the entire cycle until you have a good feel for how Liquibase works.
Now that you have a feel for Liquibase against your sample database, you can try it against your standard databases.
Just add your database's jdbc drivers to the
lib directory in the Liquibase install directory and update the
password fields in the Liquibase properties file.
Note: Liquibase 4.6.1 and later versions come with pre-installed drivers. For more information, see Adding and Updating Liquibase Drivers.
Also, check the documentation associated with your specific database to locate the correct url format and download the driver jar. Then use the Liquibase Developer Workflow to make changes against your own database.