Previously: In Adding Your First Database Change, we learned the basic workflow for adding changes. Now let's organize changes as your schema grows.
As your schema grows to 50+ changes, flat structures become unmaintainable. pgpm supports nested paths for hierarchical organization.
Old: Flat Structure (50+ changes)
Finding anything becomes tedious. No clear organization.
New: Nested Structure
Use hierarchical paths that mirror Postgres schema organization:
Example:
This creates an organized directory structure:
Key Takeaways
- Use
schemas/<schema_name>/as the foundation - Nest by object type:
tables/,functions/,triggers/,indexes/, etc. - Keep paths descriptive and consistent
- Deployment order follows plan file, not directory structure
What's Next
In the next lesson, we'll explore plan files and deployment plans.
