CI/CD Databases with Liquibase

Image by Liquibase

Why choosing Liquibase?

Liquibase Hierarchy of Changes

Image by Liquibase
  • Change Types are types of individual operations deployed into the database, such as adding a column or a primary key (See all available Change Types here).
  • ChangeSet is a unit of change that groups Change Types. There are four formats you can use for database changes: SQL, XML, JSON, and YAML.
  • Changelog is the master file with a list of ChangeSets in sequential order.

Liquibase Plugin for Maven

Project Structure

.
├── db
│ ├── changelog-master.yml
│ └── changes
│ ├── 001_createTablePerson.yml
│ ├── 002_addColumnUsername.yml
│ └── 003_addLookupTableState.yml
├── pom.xml
└── src
├── main
│ └── java
│ └── MyApp.java
└── test
└── MyAppTest.java

Setting up the pom.xml

Defining the Changes

Setting up the Changelog

Running the Update

$ mvn liquibase:update

DevOps Workflow

Step One: Checkout changes from source control

Step Two: Update the database schema

Step Three: Deploy the application

Summary

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jonathan Manera

Jonathan Manera

Software Engineer. Instructor. Trying to learn something new every day. Trying to teach what I wish I knew earlier.