CLI Reference
All dpg commands with flags and examples.
The dpg CLI is the primary interface to the DPG compiler and migration engine. All commands accept the following global flags:
| Flag | Short | Description |
|---|---|---|
--dir | -C | Project root directory (default: current working directory) |
--env | Path to .env file (default: .env in project root, if present) |
Commands
| Command | Description |
|---|---|
| dpg plan | Diff desired state vs snapshot and print the SQL migration |
| dpg apply | Execute the planned migration and update the snapshot |
| dpg verify | Check the live database for drift against the snapshot |
| dpg dump | Introspect a live database and produce initial .dpg source files |
| dpg diff | Diff two DPG source directories and print the SQL migration |
| dpg fmt | Format .dpg source files in place |
| dpg validate | Validate .dpg source files offline without diffing |
| dpg portability | Report PostgreSQL-specific constructs in use |
| dpg init | Scaffold a new DPG project |
| dpg completion | Generate shell autocompletion scripts |
| dpg docs | Serve the embedded documentation locally |
The pages in this section are auto-generated from the CLI source via make docs-cli.