Compare SQL database schemas from the command line. Zero-config, CI-native, and free. Catch breaking schema changes before they reach production.
npm install -g schema-diffnpx schema-diff old.sql new.sql
Works with any SQL CREATE TABLE dump from any database or ORM. No framework lock-in.
GitHub Actions annotations, GitLab CI output, and JUnit XML built in. Fails your build on breaking changes.
Automatically detects dropped columns, table removals, dangerous type changes, and more.
Generates ready-to-run ALTER TABLE scripts and rollback SQL for all 5 dialects.
Every diff gets a 0-100 risk score with a severity label. Know exactly how dangerous a change is.
MIT licensed. No signup, no API key, no tracking. Powered by the SchemaLens engine.
npm install -g schema-diff
schema-diff old-schema.sql new-schema.sql
Fail builds when breaking schema changes are detected:
schema-diff base.sql head.sql --dialect postgres --format github --ci --strict
| Format | Flag | Best For |
|---|---|---|
| Pretty (colored) | --format pretty | Local development |
| JSON | --format json | Programmatic consumption |
| Markdown | --format markdown | PR descriptions, documentation |
| SQL | --format sql | Running migrations directly |
| GitHub Actions | --format github | GitHub CI annotation commands |
| GitLab CI | --format gitlab | GitLab pipeline output |
| JUnit XML | --format junit | Jenkins, CircleCI, Azure DevOps |
| Feature | schema-diff | Prisma migrate diff | Redgate | schemalex |
|---|---|---|---|---|
| Zero install (npx) | โ | โ | โ | โ |
| Framework-agnostic | โ | โ | โ | โ |
| CI-native formats | โ | โ | โ | โ |
| GitHub Actions annotations | โ | โ | โ | โ |
| 5 dialects | โ | โ | โ | โ |
| Migration generation | โ | โ | โ | โ |
| Rollback generation | โ | โ | โ | โ |
| Risk scoring | โ | โ | โ | โ |
| Price | Free | Free | $369+/yr | Free |