Skip to main content
The pgroll binary version is pinned by the CLI and can be overridden with the XATA_PGROLL_BINARY_VERSION environment variable.
Every command below also takes -h, --help.

baseline

Create a baseline migration for an existing database schema
string
Postgres lock timeout in milliseconds for pgroll DDL operations
string
Postgres schema to use for pgroll internal state
string
Postgres URL
string
Optional postgres role to set when executing migrations
string
Postgres schema to use for the migration
string
Create version schemas for each migration
string
Enable verbose logging
string
Output in JSON format instead of YAML
string
Skip confirmation prompt
string
The profile to use
string
Version name for the baseline, for example 01_initial_schema
string
The directory that contains the migrations

complete

Complete an ongoing migration with the operations present in the given file
string
Postgres lock timeout in milliseconds for pgroll DDL operations
string
Postgres schema to use for pgroll internal state
string
Postgres URL
string
Optional postgres role to set when executing migrations
string
Postgres schema to use for the migration
string
Create version schemas for each migration
string
Enable verbose logging
string
The profile to use

init

Initialize pgroll in the target database
string
Postgres lock timeout in milliseconds for pgroll DDL operations
string
Postgres schema to use for pgroll internal state
string
Postgres URL
string
Optional postgres role to set when executing migrations
string
Postgres schema to use for the migration
string
Create version schemas for each migration
string
Enable verbose logging
string
The profile to use

latest

Print the name of the latest schema version or migration

latest migration

Print the latest migration name
string
Postgres lock timeout in milliseconds for pgroll DDL operations
string
Postgres schema to use for pgroll internal state
string
Postgres URL
string
Optional postgres role to set when executing migrations
string
Postgres schema to use for the migration
string
Create version schemas for each migration
string
Enable verbose logging
string
Retrieve the latest migration from a local migration directory
string
The profile to use

latest schema

Print the latest version schema name
string
Postgres lock timeout in milliseconds for pgroll DDL operations
string
Postgres schema to use for pgroll internal state
string
Postgres URL
string
Optional postgres role to set when executing migrations
string
Postgres schema to use for the migration
string
Create version schemas for each migration
string
Enable verbose logging
string
Retrieve the latest version from a local migration directory
string
The profile to use

migrate

Apply outstanding migrations from a directory to a database
string
Postgres lock timeout in milliseconds for pgroll DDL operations
string
Postgres schema to use for pgroll internal state
string
Postgres URL
string
Optional postgres role to set when executing migrations
string
Postgres schema to use for the migration
string
Create version schemas for each migration
string
Enable verbose logging
string
Duration of delay between batch backfills (eg. 1s, 1000ms)
string
Number of rows backfilled in each batch
string
Complete the final migration rather than leaving it active
string
Abort if there is more than one migration to be applied
string
The profile to use
string
The directory that contains the migrations

update

Update outdated migrations in a directory
string
Postgres lock timeout in milliseconds for pgroll DDL operations
string
Postgres schema to use for pgroll internal state
string
Postgres URL
string
Optional postgres role to set when executing migrations
string
Postgres schema to use for the migration
string
Create version schemas for each migration
string
Enable verbose logging
string
Output migration file in JSON format instead of YAML
string
The profile to use
string
The directory that contains the migrations

pull

Pull migration history from the target database and write it to disk
string
Postgres lock timeout in milliseconds for pgroll DDL operations
string
Postgres schema to use for pgroll internal state
string
Postgres URL
string
Optional postgres role to set when executing migrations
string
Postgres schema to use for the migration
string
Create version schemas for each migration
string
Enable verbose logging
string
Output each migration in JSON format instead of YAML
string
The profile to use
string
The target directory to pull migrations into

rollback

Roll back an ongoing migration
string
Postgres lock timeout in milliseconds for pgroll DDL operations
string
Postgres schema to use for pgroll internal state
string
Postgres URL
string
Optional postgres role to set when executing migrations
string
Postgres schema to use for the migration
string
Create version schemas for each migration
string
Enable verbose logging
string
The profile to use

start

Start a migration for the operations present in the given file
string
Postgres lock timeout in milliseconds for pgroll DDL operations
string
Postgres schema to use for pgroll internal state
string
Postgres URL
string
Optional postgres role to set when executing migrations
string
Postgres schema to use for the migration
string
Create version schemas for each migration
string
Enable verbose logging
string
Duration of delay between batch backfills (eg. 1s, 1000ms)
string
Number of rows backfilled in each batch
string
Mark the migration as complete
string
Skip migration validation
string
The profile to use
string
required
The migration file to start

status

Show pgroll status
string
Postgres lock timeout in milliseconds for pgroll DDL operations
string
Postgres schema to use for pgroll internal state
string
Postgres URL
string
Optional postgres role to set when executing migrations
string
Postgres schema to use for the migration
string
Create version schemas for each migration
string
Enable verbose logging
string
The profile to use

convert

Convert SQL statements to a pgroll migration
string
Postgres lock timeout in milliseconds for pgroll DDL operations
string
Postgres schema to use for pgroll internal state
string
Postgres URL
string
Optional postgres role to set when executing migrations
string
Postgres schema to use for the migration
string
Create version schemas for each migration
string
Enable verbose logging
string
Output migration file in JSON format instead of YAML
string
The profile to use
string
required
The migration file to convert