CLI Reference
pgmagmig provides the following commands:
| Command | Description |
|---|---|
extract | Apply SQL to PGlite, output JSON schema |
generate | Generate DDL from a schema |
diff | Compare two schemas, output DDL |
bootstrap | Create initial migration file(s) |
draft-migration | Generate a YAML migration from a schema diff |
verify-down | Check that down-migrations reverse their up-migrations |
migrate | Apply migrations to a PostgreSQL database |
run | Build PGlite, expose via socket, run a command |
Common patterns
Most commands accept schema source options (--from-* and/or --to-*) to specify where to read schemas from.
Error output
pgmagmig formats PostgreSQL errors cleanly, showing the error code, message, detail, and hint without stack traces:
ERROR: relation "foo" does not exist
Code: 42P01