db plan
Generate a schema diff showing what changes will be applied.
Usage
postkit db plan
Options
| Option | Description |
|---|---|
-v, --verbose | Enable verbose output |
--json | Output as JSON |
What It Does
- For each schema in
config.schemas(in array order): a. Combines all schema files fromdb/schema/<name>/intoschema_<name>.sql(excludingseeds/) b. Runspgschema plan --schema <name>to compare against the local database — saves the plan to.postkit/db/plan_<name>.sqlc. Applies the plan to the local DB immediately (intermediate apply — makes this schema's objects available for the next schema to reference at plan time) - Saves per-schema fingerprints (SHA-256 hash of source files) for validation during apply
- Displays combined plan output across all schemas
Note: The intermediate apply in step 1c is critical for cross-schema references. If schema app references public.fn(), planning app requires public.fn() to already exist in the local DB.
Requirements
- An active session must exist (run
db startfirst)