$ npm install -g schema-diff
# or use npx โ€” no install required
$ npx schema-diff old.sql new.sql

Why schema-diff?

๐Ÿ” Universal

Works with any SQL CREATE TABLE dump from any database or ORM. No framework lock-in.

โšก CI-Native

GitHub Actions annotations, GitLab CI output, and JUnit XML built in. Fails your build on breaking changes.

๐Ÿ›ก๏ธ Breaking Change Detection

Automatically detects dropped columns, table removals, dangerous type changes, and more.

๐Ÿ“ Migration Generation

Generates ready-to-run ALTER TABLE scripts and rollback SQL for all 5 dialects.

๐ŸŽฏ Risk Scoring

Every diff gets a 0-100 risk score with a severity label. Know exactly how dangerous a change is.

๐Ÿ’ฐ Free & Open Source

MIT licensed. No signup, no API key, no tracking. Powered by the SchemaLens engine.

Quick Start

1

Install

$ npm install -g schema-diff
2

Run a diff

$ schema-diff old-schema.sql new-schema.sql
3

Add to your CI pipeline

Fail builds when breaking schema changes are detected:

$ schema-diff base.sql head.sql --dialect postgres --format github --ci --strict

Output Formats

FormatFlagBest For
Pretty (colored)--format prettyLocal development
JSON--format jsonProgrammatic consumption
Markdown--format markdownPR descriptions, documentation
SQL--format sqlRunning migrations directly
GitHub Actions--format githubGitHub CI annotation commands
GitLab CI--format gitlabGitLab pipeline output
JUnit XML--format junitJenkins, CircleCI, Azure DevOps

schema-diff vs Others

Featureschema-diffPrisma migrate diffRedgateschemalex
Zero install (npx)โœ“โœ“โœ—โœ“
Framework-agnosticโœ“โœ—โœ“โœ“
CI-native formatsโœ“โœ—โœ—โœ—
GitHub Actions annotationsโœ“โœ—โœ—โœ—
5 dialectsโœ“โœ—โœ“โœ—
Migration generationโœ“โœ“โœ“โœ—
Rollback generationโœ“โœ—โœ“โœ—
Risk scoringโœ“โœ—โœ—โœ—
PriceFreeFree$369+/yrFree

Want a visual diff too?

SchemaLens is the browser-based schema diff tool that powers schema-diff. Paste two schemas, see a beautiful visual diff, and generate migrations with one click.

Try SchemaLens Free GitHub Action

Pro Features

Unlimited schema diffs, PDF export, shareable links, and 70+ free database tools. One-time purchase, lifetime access.

Get Lifetime Pro โ€” $39