Back to all articles
Database CI/CD deployment pipeline demonstrating version control, staging, and automated rollbacks.

Database CI/CD and Version Control with Oracle SQLcl and Liquibase

Leave manual SQL script deployments in the past. Discover how to treat database schema changes as code using Oracle SQLcl and Liquibase integration, with real-world CLI examples and automated pipeline strategies.

Treating Database Schemas as Code

In modern DevOps, application code is continuously tested, reviewed, and deployed through automated CI/CD pipelines. Yet, in many organizations, database deployments are still handled manually: a developer emails a migration.sql script to a DBA who executes it in production during late-night maintenance windows.

This manual process is error-prone, untraceable, and dangerous. By pairing Oracle SQLcl with Liquibase, teams can implement automated, version-controlled database migrations with full rollback capability.


Generating Changelogs with SQLcl

SQLcl includes native Liquibase commands. You can generate a complete changelog of an existing Oracle schema with a single command:

sql hr/password@localhost:1521/XEPDB1
lb generate-schema -split

This splits your schema into discrete XML/YAML/SQL files for tables, packages, views, triggers, and sequences.


Executing Automated Pipeline Deployments

In your GitHub Actions or GitLab CI/CD runner:

name: Deploy Database Changes
on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run Liquibase Update
        run: |
          sql -cloud ${{ secrets.DB_CONN_STR }}
          lb update -changelog-file controller.xml

Key Benefits

  • Automatic Rollbacks: If a migration step encounters a failure, Liquibase rolls back changes, preserving database integrity.
  • Audit Trail: Every applied change is logged in the DATABASECHANGELOG tracking table with execution timestamps and checksums.
  • Multi-Environment Parity: Dev, Test, Staging, and Production environments always stay in perfect synchronization.
Database CI/CD and Version Control with Oracle SQLcl and Liquibase · Sardunya IT | Sardunya Yazılım