Commands
Global Flags
All commands support these global flags:Environment Variables
| Variable | Description | Used By |
|---|---|---|
DATABASE_URL | PostgreSQL connection URL | extract |
Workflow
The typical pgtofu workflow involves these steps:Output Formats
JSON Schema
Theextract command outputs a JSON file containing the complete database schema:
Migration Files
Thegenerate command creates golang-migrate compatible files:
migrations
000001_description.up.sql
000001_description.down.sql
000002_description.up.sql
000002_description.down.sql
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error (invalid arguments, connection failure, schema parsing error, etc.) |