Who it is forA platform or DevOps engineer who wants database checks on every migration pull request.
The problemSchema problems often reach production because nothing checks the migration before merge.
The outcomeA CI job that exits non-zero on critical schema findings and can emit SARIF for the GitHub Security tab.
What you need first
- A PostgreSQL server version 14 to 18 that you can reach over the network
- A login role with the pg_monitor role and no write grants (pgbot init generates the setup SQL)
- The pgbot binary, installed with the curl install script or npx @pgbot/cli
- Optional: pg_stat_statements for the queries section, and hypopg on PostgreSQL 16+ for advise
Steps
- Create a disposable Postgres database for the CI job and give the job a read-only role connection string through a CI secret.
- Run
pgbot lintto check the schema with no writes to the database. (inferred, check the README) - Run
pgbot inspect --profile=schema --fail-on=criticalto make the exit code the CI gate. (inferred, check the README) - Add
--format=sarifto the inspect command to produce output for the GitHub Security tab. - Read the exit codes in CI: 0 clean, 1 warn, 2 critical, 3 connection or execution failure, 64 usage error.
Prompt for your agent
Use the pgbot tool from the pgrundev/pgbot repository in CI by running `pgbot inspect --profile=schema --fail-on=critical --format=sarif` against <ci-database-url>. Report the exit code and the number of findings in the SARIF output. Verify that exit code 3 is reported as a connection failure rather than as a finding.
Caveat. The schema profile only runs catalog-derived findings, so it does not replace checks that need live workload statistics.
Get 5 new use cases every morning. Free, one short email, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Disclaimer
Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked "Seen in the wild", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email [email protected] and we will look at it promptly. Full disclaimer page