Getting started

pgsafe parses SQL migration files and flags schema changes likely to take long-running locks or break running application code — before they reach production. It needs no database connection and no network access.

Install

Download a prebuilt binary from the latest release (static Linux and macOS builds), verify it against the matching .sha256, and put it on your PATH:

pgsafe --version

Or build from source with a Rust toolchain:

cargo build --release   # target/release/pgsafe

Lint a file

pgsafe migration.sql          # one file
pgsafe 001.sql 002.sql        # several
cat migration.sql | pgsafe -  # stdin

A clean migration exits 0; any finding at or above the gate (default: any finding) exits 1; a parse or I/O error exits 2.

See the rules reference for every hazard pgsafe checks, and CI & GitHub Action to gate migrations on every pull request.