Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI Reference

pgmagmig provides the following commands:

CommandDescription
extractApply SQL to PGlite, output JSON schema
generateGenerate DDL from a schema
diffCompare two schemas, output DDL
bootstrapCreate initial migration file(s)
draft-migrationGenerate a YAML migration from a schema diff
verify-downCheck that down-migrations reverse their up-migrations
migrateApply migrations to a PostgreSQL database
runBuild 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