Plan Files and Deployment Plans
Dan Lynch
Nov 14, 2025
Previously: In Change Naming Conventions, we learned how to organize changes with nested paths. Now let's explore plan files and how pgpm generates them.
The plan file tracks every change in your module. pgpm can automatically generate it from your SQL files, or you can manage it manually with pgpm add.
Plan File Format
Every module has a pgpm.plan file:
sh%syntax-version=1.0.0 %project=pets %uri=https://github.com/example/pets schemas/pets 2025-11-14T10:00:00Z Dan Lynch <dan@example.com> schemas/pets/tables/pets [schemas/pets] 2025-11-14T10:15:00Z Dan Lynch <dan@example.com> schemas/pets/tables/adoptions [schemas/pets/tables/pets] 2025-11-14T10:30:00Z Dan Lynch <dan@example.com>
Format: change_name [dependencies] timestamp author <email> # optional note
Two Workflows
Production: Add Changes Incrementally
bashpgpm add schemas/pets pgpm add schemas/pets/tables/pets --requires schemas/pets pgpm add schemas/pets/tables/adoptions --requires schemas/pets/tables/pets
pgpm updates the plan file automatically. Add changes like commits in version control.
Pre-Production: Generate from SQL
Write SQL first for more flexibility. Add -- requires: comments:
In deploy/schemas/pets.sql:
sql-- Deploy schemas/pets CREATE SCHEMA pets;
In deploy/schemas/pets/tables/pets.sql:
sql-- Deploy schemas/pets/tables/pets -- requires: schemas/pets CREATE TABLE pets.pets (id UUID PRIMARY KEY);
In deploy/schemas/pets/tables/adoptions.sql:
sql-- Deploy schemas/pets/tables/adoptions -- requires: schemas/pets/tables/pets CREATE TABLE pets.adoptions ( id UUID PRIMARY KEY, pet_id UUID REFERENCES pets.pets(id) );
Then generate the plan:
bashpgpm plan
pgpm scans your SQL files, builds the dependency graph, and updates pgpm.plan.
Note:
pgpm planregenerates the entire plan. In production, usepgpm addto append changes without regenerating history.
Key Takeaways
pgpm addadds changes manually to the planpgpm planauto-generates plans from-- requires:comments in SQL- Use
pgpm addfor production,pgpm planfor early development

