v1.1.0 — 48 rules, auto-fix, risk scoring

Know what your migration
will do to production

48 safety rules powered by the real PostgreSQL parser. Lock analysis, risk scoring, auto-fix, and safe alternatives — all without touching your database. Works as a CLI, GitHub Action, and Node.js library.

45 rules free forever. Pro adds production context.

migrationpilot analyze 002_alter_users.sql
  MigrationPilot — migrations/002_alter_users.sql

  Risk:  RED  Score: 80/100

  ┌───┬───────────────────────────────────────┬──────────────────┬────────┬───────┐
  │ # │ Statement                             │ Lock Type        │ Risk   │ Long? │
  ├───┼───────────────────────────────────────┼──────────────────┼────────┼───────┤
  │ 1 │ CREATE INDEX idx_users_email ON us... │ SHARE            │ REDYES   │
  │ 2 │ ALTER TABLE users ADD CONSTRAINT... │ ACCESS EXCLUSIVE │ REDYES   │
  └───┴───────────────────────────────────────┴──────────────────┴────────┴───────┘

  Violations:

  ✗ [MP001] CRITICAL
    CREATE INDEX blocks writes on "users". Use CREATE INDEX CONCURRENTLY.
    Why: Blocks all INSERT/UPDATE/DELETE for the entire duration of index creation.
    Safe alternative:
    CREATE INDEX CONCURRENTLY idx_users_email ON users (email);

  ✗ [MP005] CRITICAL
    ADD CONSTRAINT without NOT VALID scans entire table under ACCESS EXCLUSIVE.

  ⚠ [MP004] WARNING
    No SET lock_timeout before DDL on "users".
    Auto-fixable: run with --fix

  48 rules checked in 23ms

Everything you need for safe migrations

Static analysis powered by the real PostgreSQL parser (libpg-query). No regex heuristics. PG-version-aware advice (9-20).

🔒

Lock Analysis

Know exactly which PostgreSQL lock each DDL statement acquires — SHARE through ACCESS EXCLUSIVE — and whether it blocks reads, writes, or both.

🛡️

48 Safety Rules

From missing CONCURRENTLY to type narrowing. Catches the patterns that cause production outages. More rules than any competitor.

🔧

Auto-fix

6 rules can be automatically fixed with --fix. Missing CONCURRENTLY, lock_timeout, statement_timeout, NOT VALID — applied in-place.

📊

Risk Scoring

RED / YELLOW / GREEN scores (0-100) based on lock severity, table size, and query frequency. Production context powers Pro scoring.

🤖

GitHub Action

Posts safety reports as PR comments. Auto-updates on each push. SARIF output for GitHub Code Scanning integration.

🔍

14 Framework Detection

Auto-detects Prisma, Django, Rails, Flyway, Alembic, Knex, TypeORM, Drizzle, Sequelize, goose, dbmate, Sqitch, Liquibase, Ecto.

👁️

Watch Mode

Watch migration files and re-analyze on change. Plus git pre-commit hook integration for catching issues before they leave your machine.

⚙️

Config + Presets

3 built-in presets (recommended, strict, ci). Per-rule severity overrides, custom thresholds, inline disable comments, .migrationpilotrc.yml.

📋

6 Output Formats

Text, JSON (versioned schema), SARIF v2.1.0, Markdown, quiet (gcc-style), verbose. Pipe from stdin, output to any CI system.

48 rules. Zero false positives.

Built from real production incidents. More free rules than Squawk (31) and Atlas (~15). Every rule catches a specific dangerous pattern.

Lock Safety

MP001CRITICALrequire-concurrent-index
MP002CRITICALrequire-check-not-null
MP003CRITICALvolatile-default-rewrite
MP004CRITICALrequire-lock-timeout
MP005CRITICALrequire-not-valid-fk
MP006CRITICALno-vacuum-full
MP007CRITICALno-column-type-change
MP008CRITICALno-multi-ddl-transaction
MP025CRITICALban-concurrent-in-transaction
MP026CRITICALban-drop-table
MP027CRITICALdisallowed-unique-constraint
MP030CRITICALrequire-not-valid-check
MP031CRITICALban-exclusion-constraint
MP032CRITICALban-cluster
MP046CRITICALconcurrent-detach-partition
MP047CRITICALban-set-logged-unlogged

Data Safety

MP034CRITICALban-drop-database
MP035CRITICALban-drop-schema
MP036CRITICALban-truncate-cascade

Best Practices

MP009WARNINGrequire-drop-index-concurrently
MP010WARNINGno-rename-column
MP011WARNINGunbatched-backfill
MP012WARNINGno-enum-add-in-transaction
MP015WARNINGno-add-column-serial
MP016WARNINGrequire-fk-index
MP017WARNINGno-drop-column
MP018WARNINGno-force-set-not-null
MP020WARNINGrequire-statement-timeout
MP021WARNINGrequire-concurrent-reindex
MP022WARNINGno-drop-cascade
MP023WARNINGrequire-if-not-exists
MP024WARNINGno-enum-value-removal
MP028WARNINGno-rename-table
MP029WARNINGban-drop-not-null
MP033WARNINGconcurrent-refresh-matview
MP037WARNINGprefer-text-over-varchar
MP038WARNINGprefer-bigint-over-int
MP039WARNINGprefer-identity-over-serial
MP040WARNINGprefer-timestamptz
MP041WARNINGban-char-field
MP042WARNINGrequire-index-name
MP043WARNINGban-domain-constraint
MP044WARNINGno-data-loss-type-narrowing
MP045WARNINGrequire-primary-key
MP048WARNINGban-alter-default-volatile

Production Context

MP013PROhigh-traffic-table-ddl
MP014PROlarge-table-ddl
MP019PROexclusive-lock-connections

Simple, transparent pricing

45 rules free forever. Pro when you need production context.

Free

$0forever

Static analysis for every team

  • 45 safety rules (MP001-MP048)
  • CLI + GitHub Action
  • 6 output formats (text, JSON, SARIF, markdown)
  • Auto-fix (6 rules)
  • PR comments
  • Config file + 3 presets
  • Watch mode + pre-commit hooks
  • 14 framework auto-detection
Get Started

Pro

$29/month

Production context for critical apps

  • Everything in Free
  • Production context queries (pg_stat_*, pg_class)
  • Table size + query frequency scoring
  • 3 production rules (MP013, MP014, MP019)
  • Affected queries in PR comments
  • Enhanced risk scoring (0-100)
  • Priority support
Get Pro

Enterprise

Custom

For large teams and compliance

  • Everything in Pro
  • Team license management
  • SSO / SAML
  • Audit logs
  • Dedicated support
  • Custom rules
Contact Us

Stop shipping dangerous migrations

Add MigrationPilot to your CI in 30 seconds. 48 rules catch lock issues before they reach production.

# .github/workflows/migration-check.yml
- uses: mickelsamuel/migrationpilot@v1
  with:
    migration-path: "migrations/*.sql"
    fail-on: critical