Zero-downtime, reversible schema migrations for Postgres
open sourceApache-2.0free
pgroll is an open source command-line tool from Xata for zero-downtime, reversible schema migrations on PostgreSQL. While a migration runs it serves the old and new schema versions at once, through views, so clients on either version keep working; it backfills columns when needed, takes no blocking locks, and rolls back instantly if something goes wrong. It works on existing schemas and any Postgres 14 or later service, including RDS and Aurora, and is a single Go binary for Linux, macOS and Windows.
Problems it solves
- run Postgres schema migrations with zero downtime, keeping old and new schema versions working at once
- rename a column in Postgres without breaking the app version still running
- roll back a Postgres migration instantly
Features
- Zero-downtime migrations without blocking locks
- Old and new schema versions served at once
- Automatic column backfills
- Instant rollback
- Works on existing schemas
- Postgres 14 or later, including RDS and Aurora
Alternatives
The same job
These do what pgroll does.
- Reshape An easy-to-use, zero-downtime schema migration tool for Postgres
- pgschema Terraform-style declarative schema migrations for PostgreSQL: dump, edit, plan, apply
- sqldef Idempotent schema management in plain SQL for MySQL, PostgreSQL, SQLite and SQL Server
- Flyway Versioned SQL database migrations for 50+ databases, open source with Redgate's enterprise editions
- Atlas Database schema as code: plan, lint, test and apply schema migrations, like Terraform for databases
- golang-migrate Database migrations as a CLI and Go library
