roll
commands help you manage database migrations using pgroll.
Subcommands
baseline
Create a baseline migration for an existing database schema.Postgres lock timeout in milliseconds for pgroll DDL operations
Postgres schema to use for pgroll internal state
Postgres URL
Optional postgres role to set when executing migrations
Postgres schema to use for the migration
Create version schemas for each migration
Enable verbose logging
Output in JSON format instead of YAML
Skip confirmation prompt
Print help information and exit
Name of the migration (e.g., “01_initial_schema”)
The directory that contains the migrations (default:
.xata/migrations
)complete
Complete an ongoing migration with the operations present in the given file.Postgres lock timeout in milliseconds for pgroll DDL operations
Postgres schema to use for pgroll internal state
Postgres URL
Optional postgres role to set when executing migrations
Postgres schema to use for the migration
Create version schemas for each migration
Enable verbose logging
Print help information and exit
init
Initialize pgroll in the target database.Postgres lock timeout in milliseconds for pgroll DDL operations
Postgres schema to use for pgroll internal state
Postgres URL
Optional postgres role to set when executing migrations
Postgres schema to use for the migration
Create version schemas for each migration
Enable verbose logging
Print help information and exit
latest
Print the name of the latest schema version, either in the target database or a local directory.Postgres lock timeout in milliseconds for pgroll DDL operations
Postgres schema to use for pgroll internal state
Postgres URL
Optional postgres role to set when executing migrations
Postgres schema to use for the migration
Enable verbose logging
Retrieve the latest version from a local migration directory
Prefix the version with the schema name
Print help information and exit
migrate
Apply outstanding migrations from a directory to a database.Postgres lock timeout in milliseconds for pgroll DDL operations
Postgres schema to use for pgroll internal state
Postgres URL
Optional postgres role to set when executing migrations
Postgres schema to use for the migration
Enable verbose logging
Duration of delay between batch backfills (eg. 1s, 1000ms)
Number of rows backfilled in each batch
Complete the final migration rather than leaving it active
Print help information and exit
The directory that contains the migrations (default:
.xata/migrations
)update
Update outdated migrations in a directory.Postgres lock timeout in milliseconds for pgroll DDL operations
Postgres schema to use for pgroll internal state
Postgres URL
Optional postgres role to set when executing migrations
Postgres schema to use for the migration
Enable verbose logging
Print help information and exit
The directory that contains the migrations (default:
.xata/migrations
)pull
Pull migration history from the target database and write it to disk.Postgres lock timeout in milliseconds for pgroll DDL operations
Postgres schema to use for pgroll internal state
Postgres URL
Optional postgres role to set when executing migrations
Postgres schema to use for the migration
Enable verbose logging
Output each migration in JSON format instead of YAML
Prefix each migration filename with its position in the schema history
Print help information and exit
The target directory to pull migrations into (default:
.xata/migrations
)rollback
Roll back an ongoing migration.Postgres lock timeout in milliseconds for pgroll DDL operations
Postgres schema to use for pgroll internal state
Postgres URL
Optional postgres role to set when executing migrations
Postgres schema to use for the migration
Enable verbose logging
Print help information and exit
start
Start a migration for the operations present in the given file.The migration file to start
Postgres lock timeout in milliseconds for pgroll DDL operations
Postgres schema to use for pgroll internal state
Postgres URL
Optional postgres role to set when executing migrations
Postgres schema to use for the migration
Create version schemas for each migration
Enable verbose logging
Duration of delay between batch backfills (eg. 1s, 1000ms)
Number of rows backfilled in each batch
Mark the migration as complete
Skip migration validation
Print help information and exit
status
Show pgroll status.Postgres lock timeout in milliseconds for pgroll DDL operations
Postgres schema to use for pgroll internal state
Postgres URL
Optional postgres role to set when executing migrations
Postgres schema to use for the migration
Enable verbose logging
Print help information and exit
convert
Convert SQL statements to a pgroll migration.The migration file to start
Postgres lock timeout in milliseconds for pgroll DDL operations
Postgres schema to use for pgroll internal state
Postgres URL
Optional postgres role to set when executing migrations
Postgres schema to use for the migration
Enable verbose logging
Output migration file in JSON format instead of YAML
Print help information and exit
Global Flags
Print help information and exit