Quick Start

Install#

Note: due to squawk's dependency on libpg_query, squawk only supports Linux and macOS

npm install -g squawk-cli
# or install binaries directly via the releases page
https://github.com/sbdchd/squawk/releases

Usage#

example-migration.sql
# create example SQL migration
cat <<EOF > example-migration.sql
BEGIN;
ALTER TABLE table_name ADD CONSTRAINT field_name_constraint UNIQUE (field_name);
COMMIT;
EOF
# lint with squawk
squawk example-migration.sql

❯ squawk example-migration.sql
example-migration.sql:2:1: warning: disallowed-unique-constraint
2 | ALTER TABLE table_name ADD CONSTRAINT field_name_constraint UNIQUE (field_name);
note: Adding a UNIQUE constraint requires an ACCESS EXCLUSIVE lock which blocks reads.
help: Create an index CONCURRENTLY and create the constraint using the index.

See "Running Migrations" for information about safely applying migrations in Postgres.

The CLI docs have more information about the squawk CLI tool and the GitHub Integration docs outline configuring Squawk to work with GitHub pull requests.