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 diagnostic
265Automated tests passed for release
14–18PostgreSQL integration versions tested
MITOpen-source license

Get started

Install the CLI as a development dependency, then analyze a saved migration file.

npm install --save-dev @subodh001/pg-safe-migrate@2.6.0
npx pg-safe-migrate migration.sql --advisor

Alternatively, run the CLI without adding it to your project:

npx --yes --package=@subodh001/pg-safe-migrate@2.6.0 pg-safe-migrate migration.sql --advisor

Built 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

  1. Write and save your migration SQL.
  2. Run the linter and review the findings with your team.
  3. Revise risky operations and validate against representative data.
  4. Enforce agreed policies in CI before deployment.

Read the CLI documentation · Report an issue or share feedback

Frequently asked questions

Is PG Safe Migrate free?

Yes. The CLI and extension are open source under the MIT license.

Does it connect to my production database?

Ordinary static SQL linting does not require a database connection. Optional database inspection and simulation have separate configuration requirements.

Does it guarantee zero downtime?

No. It helps identify configured risks; production validation and operational review are still necessary.