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

generate

Generate DDL from a schema. This is an alias for diff --from-empty --to-*.

Usage

pgmagmig generate --to-sql schema.sql
pgmagmig generate --to-json schema.json

Options

OptionDescription
--to-sql <files...>SQL files defining the target schema
--to-json <file>JSON schema file
--to-emptyEmpty schema (produces no output)
--to-database <url>Live database
--to-migrations-dir <path>Migration files

Exactly one --to-* option is required. See Schema Sources.

Output

DDL statements written to stdout that would create the entire schema from scratch.

Example

pgmagmig generate --to-json schema.json > create.sql