Project files, metadata, tests, and parameters become session-scoped temporary tables and stable views.
Programmable PostgreSQL deployments
pgmi
Your deploy.sql applies changes, can run database tests before COMMIT, and aborts the deployment if a test fails. pgmi loads your project into one PostgreSQL session; your SQL decides what runs and when it commits. Coding agents get PostgreSQL skills and tools to build and test the same way.
Execution model
pgmi prepares the session. Your SQL decides the deployment.
deploy.sql queries those views and executes what it selects, choosing ordering, filtering, transactions and idempotency. PostgreSQL reports notices and errors directly.
CALL pgmi_test() runs your __test__/ tree against the uncommitted changes. A directory's fixture applies to every test below it, and each test rolls back to its directory's fixture state. A failing test aborts the transaction it runs in.
The basic and advanced templates give coding agents PostgreSQL skills: schema design, constraints, indexing, row-level security, concurrency and tests. pgmi serve lets an agent deploy and check its work; the skills are your project's files. MCP endpoints your own application serves at runtime are a separate, advanced-template feature.
Start here
Three ways to start a project.
Minimal — the default
Three files: a deploy.sql loop that runs every SQL file in path order, hello_world.sql and a .pgmiignore. No test gate supplied: add CALL pgmi_test() to your deploy.sql when you want one.
The basic template
Tables in physical/ run once, tracked in a ledger that rejects changes to files already applied; views and functions in semantic/ re-run on every deploy; tests run before the commit. PostgreSQL 15+.
The advanced template
Your application's backend in PostgreSQL, as code you own: HTTP API, sign-in, tenancy and audit, served by reference gateways in five languages. Tests run before the commit. PostgreSQL 18+.
Read the guide before choosing itpgmi takes no position on architecture: each template is a starting point you own (what pgmi gives you, and what you own).
Where it fits
Deployment behavior written in SQL.
Use pgmi when deployment logic belongs close to the database: environment-aware changes, test gates, data loads, generated APIs, or application behavior expressed in SQL.
- CLI flags stay focused on infrastructure: connections, parameters, compatibility, observability.
- Deployment behavior stays in
deploy.sql, where it can be reviewed and tested with the rest of the database code.