Skip to content

fixed-width/pgsafe

Repository files navigation

pgsafe

Static safety linter for PostgreSQL DDL migrations. pgsafe parses SQL and flags schema changes likely to lock or break production — no database connection, no network.

📖 Full documentation, the rules reference, and an in-browser playground: pgsafe.fixedwidth.tech

Install

Install from crates.io with a Rust toolchain:

cargo install pgsafe

Or download a prebuilt binary from the latest release (static Linux and macOS), or build from source with cargo build --release (binary at target/release/pgsafe).

Quickstart

pgsafe migration.sql                 # lint a file (exit 1 on a finding)
pgsafe --format json migration.sql   # machine-readable
pgsafe --list-rules                  # every rule this build checks

Run it in CI with the GitHub Action:

- uses: fixed-width/pgsafe@v0.8.6
  with:
    files: "db/migrate/*.sql"

See pgsafe.fixedwidth.tech/docs for configuration, output formats, and the full rules reference.

License

Apache-2.0. See LICENSE.