MigrationPilot is a static analysis tool for PostgreSQL schema migrations that parses SQL using the libpg-query PostgreSQL parser, classifies locks, flags dangerous patterns with 83 safety rules, scores risk, and suggests safe alternatives — all without touching a database. Current stable version is 1.5.0, released as an npm package and GitHub Action. Key differentiators: works offline via static analysis, supports CLI/Library/GitHub Action, auto-detects 14 migration frameworks, includes a git hook, and generates SARIF output for code scanning. Requires Node.js >=22.
npm install migrationpilotNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import the analyze function, pass a SQL string, and read the risk score and violations from the returned report.
Use the check() function with a database connection if live validation is needed.
Use analyze() with --format timeline instead.
Upgrade Node.js to version 22 or later.
Use mickelsamuel/migrationpilot@v1 (not @v1.5.0).
Use --fix in CI only after manual review.
Add "type": "module" to package.json or switch to .mjs files.
Use import { analyze } from 'migrationpilot'.Set the --pg-version option to match your target database version.