Skip to content

$ komparo --help

Snapshot. Validate.
Catch the drift.

Komparo is a standalone Go CLI that records a PostgreSQL schema and checks any other database against it. You find the missing index in CI, not in the incident channel.

komparo validate --file expected_schema.json
! 4 divergences in prod_db

STATUS     TYPE     OBJECT                DETAILS
Missing    Column   users.last_login_at   expected timestamp
Mismatch   Column   orders.total_amount   (10,2) → (12,4)
Mismatch   Index    idx_users_email       definition differs
Extra      View     vw_legacy_reports     not in snapshot

exit status 1

Everything you need to keep schemas honest

Komparo reads the whole database topology (tables, indexes, functions, sequences) and tells you exactly what changed.

Deep PostgreSQL inspection
Targeted catalog queries pull columns, constraints, indexes, sequences and functions without scanning your data.
Divergence you can read
Every difference is labeled missing, mismatch or extra, with the expected and actual definition side by side. A non-zero exit code fails the pipeline.
One Go binary
No runtime, no agent, no extra dependencies. Drop it into any CI image and diffs come back in seconds.

Running in three commands

Snapshot a known-good database, then validate any environment against that file.

  1. 1

    Install the CLI

    Install with Go. Nothing else to set up.

    $ go install github.com/rda-run/komparo@latest
  2. 2

    Capture the expected schema

    Point Komparo at your reference database, usually the one your CI migrations just built, and write a JSON snapshot.

    $ komparo snapshot \
        --db "postgres://user:pass@localhost:5432/ephemeral_db?sslmode=disable" \
        --out expected_schema.json
  3. 3

    Validate the target database

    Run against production, staging or a customer install. Any drift prints a report like the one above and exits non-zero.

    $ komparo validate \
        --db "postgres://user:pass@prod-db.internal:5432/prod_db?sslmode=require" \
        --file expected_schema.json