Using Liquibase to Achieve CI/CD for Databases
Application release technology has come a long way in the past several years. It used to take weeks or even months to release new software. Now that organizations have adopted new workflows and processes, the time it takes to complete a release has been reduced to days and even hours. It’s an exciting time. However, there is one area that hasn’t benefited from the DevOps movement as much. The database change process isn’t nearly as automated or as fast as app code changes.
Database Schema Migration
Database schema migrations are an essential task for every software project. There are several different reasons why updates to the database are required, some examples are:
- New features require new attributes in existing tables or entirely new tables
- Bug fixes may lead to changes in names or data types in the database
- Performance issues that require additional indexes in the database
Even in organizations that have adopted DevOps, manual rework is the norm when it comes to database schema and stored procedure changes.1 In fact, the faster the application release cycle, the more database professionals had to rework database changes. 93% of survey respondents reported reworking database changes multiple times for daily or weekly release cycles.1
Before we jump into how Liquibase fits into the CI/CD process, let’s cover what we mean by CI/CD.
What is Continuous Integration (CI)?
Continuous integration (CI) is a process that automates the integration of code changes from multiple developers a single software project. The CI process hinges on a source code version control system, such as Git (or Github, BitBucket, and many others) or TFS Version Control, coupled with automated processes for code quality tests, syntax style review tools, and more. These processes can be triggered when new code is merged or committed to a shared repository, thus the name “Continuous Integration.”
What is Continuous Deployment (CD)?
Continuous Deployment (CD) is a process that automates testing to validate if code changes are correct, stable and deployable. If so, in a literal CD context, code is automatically deployed to production as soon as these conditions are met.
CI/CD for Databases Using Liquibase
Implementing end-to-end CI/CD requires all code (including database code) to be checked in to a version control system and be deployed as part of the software release process. Liquibase can help you achieve this.
Each database schema change you make with Liquibase is called a “changeset.” All changesets are tracked by Liquibase using changelogs. Liquibase allows you to create a trigger that updates the database automatically by pointing to the changelog file. From here, it makes it easy to integrate the process into your overall CI/CD process:
- Push your changeset files to your feature repository
- Create a pull request against the Dev branch
- After peer review and approvals, merge the feature branch with the Dev branch
- The CI/CD implementation configured on the Dev server triggers Liquibase for database updates
- Liquibase automatically executes any new changelog files (and is awesome enough to remember which scripts have already run)
Three Ways to Integrate Databases into Your CI/CD Process
Companies have software teams of all shapes, sizes, and types. These teams may run anything from huge mission-critical databases to newer NoSQL databases. The one thing that every team has in common is the need for a process to handle database version control and changes to ensure that applications deploy quickly and without errors.
Since each software team is different, it makes sense for organizations to choose the right database change management solution based on team makeup, the complexity of the database, how frequently it needs to be updated, and the importance of applications it supports.
Track, Version and Deploy Database Changes
Liquibase offers products at three levels to help increase productivity for every software team’s use case.
Open source and always free
Liquibase provides a great starting point for teams addressing the challenges that come with managing database changes. Founded over a decade ago, Liquibase is the leading open source solution for helping teams track, version, and deploy database changes. It has been downloaded over 12 million times by teams around the world and is built into solutions such as Spinnaker and Appian. It’s simple enough for beginners and powerful enough to support advanced use cases that involve reworking database changes.
- Track, version, deploy, and rework database changes
- Active online community with forum support
More features and support
Liquibase Pro adds more features to Liquibase’s powerful database change control capabilities, including targeted rollbacks and the ability to track, version, and deploy Store Logic.
While Liquibase is a great starting point, teams that want best practices on how to make the most of Liquibase may find Liquibase Pro better suited to their needs.
- Targeted rollbacks
- Track, version, and deploy Stored Logic
- Guidance and best practices for your specific use case(s)
- Email and ticketed support
A comprehensive solution with enterprise features and world-class support
Datical enhances the database change management experience with access to advanced capabilities such as automatic enforcement of predefined DBA rules (improving productivity), a simulator that forecasts the impact of database changes before they are deployed (reducing risk and eliminating downtime), and a dashboard that automates tracking and reporting of every database deployment (simplifying audits).
Datical provides more than just software; it offers built-in, consultative implementation assistance and support that gets teams to database release automation success faster with lower risk.
We partner with your whole team to ensure your mission-critical database changes are deployed safely and seamlessly.
- Automated change validation
- Automated dependency and impact analysis
- Object tracking
- Drift reconciliation
- Enterprise plugins
- Dedicated, world-class implementation & support
1 2019 State of Database Deployments in Application Delivery. Dimensional Research. https://www.datical.com/whitepapers/survey-the-state-of-database-deployments-in-application-delivery-2019/