Skip to main content

Commands

Global Flags

All commands support these global flags:

Environment Variables

Workflow

The typical pgtofu workflow involves these steps:

Output Formats

JSON Schema

The extract command outputs a JSON file containing the complete database schema:

Migration Files

The generate 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

Docker Usage

When running via Docker, mount your working directory:
Create an alias for easier usage:

Next Steps

extract

Learn how to extract database schemas

diff

Compare schemas and preview changes

generate

Generate migration files

partition

Generate hash partition statements