$ komparo --help
Snapshot. Validate.
prod_db · komparo validate
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 --db "$DATABASE_URL" --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 $
features
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.
Three statuses, one exit code
| status | what it means | example |
|---|---|---|
| missing | In the snapshot, not in the target. | users.last_login_at |
| mismatch | In both, with different definitions. | orders.total_amount (10,2) → (12,4) |
| extra | In the target, not in the snapshot. | vw_legacy_reports |
quick start
Running in three commands
Snapshot a known-good database, then validate any environment against that file.
-
1
Install the CLI
Install with Go. Nothing else to set up.
bash $ go install github.com/rda-run/komparo@latest
-
2
Capture the expected schema
Point Komparo at your reference database, usually the one your CI migrations just built, and write a JSON snapshot.
bash $ komparo snapshot \ --db "postgres://user:pass@localhost:5432/ephemeral_db?sslmode=disable" \ --out expected_schema.json
-
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.
bash $ komparo validate \ --db "postgres://user:pass@prod-db.internal:5432/prod_db?sslmode=require" \ --file expected_schema.json