MigraDiff

PostgreSQL Schema Migrations With Confidence

Fork of djrobstep/migra. All original features. Modernized, maintained, enhanced. AI-powered analysis, rollback capability, risk assessment — without vendor lock-in.

Install from PyPI View Licensing

What MigraDiff does.

MigraDiff performs automatic schema diffing and migration generation for PostgreSQL. It compares two database states — live databases, SQL files, or any combination — and produces the exact SQL needed to migrate from one to the other.

Beyond diffing, MigraDiff provides AI-powered migration analysis including --explain (what a migration will do), --rollback (generate undo SQL), --advise (risk assessment), and --generate (natural language to migration SQL). Additional capabilities include --explain-drift for detecting unmanaged schema changes and --document for auto-generating schema documentation.

Supports multi-schema databases, row-level security (RLS) diffing, JSON output for automation and CI/CD integration. Runs locally with full control. No vendor lock-in. No cloud dependency.

All the original features. Now actively maintained.

All Original Features

Everything djrobstep/migra did — automatic diffing, migration generation, schema comparison — now actively maintained and production-ready.

Modern Python

3.12+ compatible. Fixed deprecated patterns. Type-annotated codebase. Clean, auditable, and ready for modern Python environments.

New Capabilities

AI-powered --explain, --rollback, --advise, --generate (using Claude). --explain-drift for unmanaged schema changes. --document for auto-generating schema docs. JSON output for automation.

Enterprise Features

Multi-schema support, RLS diffing, compliance-ready documentation. Built for teams that need production-grade database tooling.

Maintained & Auditable

Open source with clear upgrade path from original migra. Active development. No abandonment risk. Backward compatible.

Email Support & Licensing

Enterprise-grade support included with Business License. SLA guarantees for critical production migrations. Vendor accountability.

Beyond the fork.

Feature Original migra MigraDiff
Core schema diffing
Python 3.12+ compatibility
AI-assisted migration analysis
Rollback capability & risk assessment
Multi-schema support
Row-level security (RLS) diffing
JSON output & automation
Auto-documentation (--document)
Email support & licensing
Active maintenance & updates
Why fork over abandoned tool. The original djrobstep/migra is no longer maintained. MigraDiff adds modern Python support, AI features, and enterprise capabilities without breaking changes — all while preserving full backward compatibility. Active development roadmap includes pgAudit integration, WAL-G integration, and expanded automation.

Where MigraDiff fits.

CI/CD pipeline automation

Automate schema migrations in deployment pipelines. Generate, validate, and apply migrations with confidence using risk assessment.

Schema drift detection

Production databases accumulate unmanaged schema changes. --explain-drift catches differences between intended and actual schema state.

Multi-tenant PostgreSQL

Manage schema migrations across hundreds of database tenants with multi-schema support and consistent diffing.

Compliance & audit

Documented schema changes for HIPAA, PCI-DSS, SOC 2 audits. Auto-generated schema documentation for compliance evidence.

Ready to migrate.