Skip to content

DB Schema Diff

Is QA's schema really the same as production's? DB Schema Diff answers that before something fails at runtime. It inventories one master PostgreSQL database and compares it against one or more other environments of the same service, structurally and by Liquibase changelog state.

It ships as a desktop application and a command-line tool, runs on Linux, macOS and Windows, and exits with a code your CI pipeline can gate on.

Install Quick start View on GitHub

What it compares

Tables, columns, constraints, indexes, views, materialized views, sequences, functions, procedures, triggers, enums, domains, composite and range types and extensions — plus Liquibase changelog state: which environment is behind, by how many changesets, and where the two histories split.

Why teams use it

  • Real drift only. Types, defaults, serial and identity columns, generated columns, check expressions and index expressions are normalised against real PostgreSQL output, so reformatting is not reported as a difference.
  • Safe on production. Every source is inspected in a read-only REPEATABLE READ transaction with statement and lock timeouts. See Credentials.
  • Built for CI. Reports in JSON, JUnit XML and a single self-contained HTML file, and documented exit codes that separate drift from an unreachable database.
  • Credentials stay out of reach. The command line reads them from the environment only; the desktop application keeps the password in the operating system keychain.
  • Adoptable on day one. A baseline accepts the drift you already have and fails only on what is new; ignore rules tolerate expected differences without hiding anything.
  • Works behind a bastion. SSH tunnels are built in.

Try it in two minutes

export PROD_DSN='postgresql://user:pass@db-prod:5432/invoicing'
export QA_DSN='postgresql://user:pass@db-qa:5432/invoicing'

db-schema-diff compare -c config.yaml --html report.html

Start from the example configuration, or follow the worked example from first probe to a CI gate.

Documentation

Install .deb, .rpm, macOS disk image, Windows build, pip
Command line Every command and flag, offline comparison, report formats
Credentials Environment variables, keychain, SSH tunnels
Liquibase Changelog comparison and how identity is decided
Ignore rules Tolerate expected differences, keep them visible
Desktop application Connect, run and read results in a window
Exit codes What each code means and what to do in CI
FAQ Short answers to common questions