OPEN SOURCE / MIT LICENSE
Catch risky PostgreSQL migrations before production.
PG Safe Migrate helps developers identify destructive schema changes, understand migration risks and enforce review policies before deployment.
CLI v2.6.0 · VS Code v0.7.0
migration.sql
ALTER TABLE users DROP COLUMN email;PG002 · Destructive column removal
Dropping this column can break older application instances.
Advisor: Stop referencing the column in deployed application versions before dropping it in a later release.
Illustrative diagnosticGet started
Install the CLI as a development dependency, then analyze a saved migration file.
npm install --save-dev @subodh001/pg-safe-migrate@2.6.0npx pg-safe-migrate migration.sql --advisorAlternatively, run the CLI without adding it to your project:
npx --yes --package=@subodh001/pg-safe-migrate@2.6.0 pg-safe-migrate migration.sql --advisorBuilt for migration review
Migration analysis
Detect destructive schema changes and potentially disruptive locks using PostgreSQL syntax analysis.
Safety advisor
Understand findings and review suggested migration alternatives.
CI policy gates
Apply team policies and generate machine-readable JSON, SARIF or Markdown reports.
Editor diagnostics
Review SQL findings in VS Code with cancellation and bounded lint scheduling.
Framework support
Analyze raw SQL and migration directories from Prisma, Drizzle and Flyway.
Migration simulation
Test migrations against disposable PostgreSQL databases before deployment.
From local development to CI
- Write and save your migration SQL.
- Run the linter and review the findings with your team.
- Revise risky operations and validate against representative data.
- Enforce agreed policies in CI before deployment.
Read the CLI documentation · Report an issue or share feedback