Zero-downtime, reversible
schema migrations
pgroll makes PostgreSQL schema changes safe by default. No table locks, instant rollbacks, and multi-version schema support — so old and new clients work simultaneously.
Schema changes shouldn't be scary
Traditional migration tools force trade-offs between safety and speed. pgroll eliminates that trade-off.
The problem
Table locking. ALTER TABLE commands can lock large tables for minutes or hours, blocking all reads and writes.
Deployment windows. Schema changes are risky enough that teams delay them to off-peak hours, slowing iteration.
Rollback complexity. Rolling back a migration typically means writing another migration. Under pressure, this goes wrong.
The pgroll way
Online migrations. All schema changes are performed online. No table locks, no downtime, no maintenance windows.
Instant rollback. Rolling back means dropping views and temporary columns. One command, instant effect, no data loss.
Simple workflow. Old and new schemas are available simultaneously. No multi-step deployment choreography, no temporary compatibility code.
The expand-and-contract pattern
pgroll automates a proven pattern for safe schema evolution. Two schema versions coexist, giving you a graceful migration window.
Multi-version schemas
pgroll uses PostgreSQL views to present two versions of the schema simultaneously. Old clients keep working while new clients use the updated schema — no coordination required.
Expand-and-contract pattern
Automates the expand-and-contract pattern. Hidden columns are added during expand, old columns dropped during contract. Complex multi-step migrations become a single operation.
Automated data backfills
Handles data conversion and backfills automatically. No one-time scripts, no manual data manipulation — pgroll manages the entire lifecycle of the migration.
Get started in five steps
Install pgroll
Available via Homebrew, Go install, or prebuilt binaries. Single binary, no external dependencies.
Initialize your database
Run pgroll init to set up the internal schema pgroll uses to manage migrations. Non-destructive — works with existing schemas.
Write a migration
Define your schema change as a JSON migration file. pgroll validates it before execution.
Start the migration
pgroll start creates the new schema version alongside the old one. Both are live and serving traffic.
Complete or rollback
When ready, pgroll complete drops the old version. Or pgroll rollback reverts instantly. Either way, zero downtime.
Works with any Postgres
pgroll supports PostgreSQL 14.0 and later. Use it with AWS RDS, Aurora, GCP Cloud SQL, Azure Database, Supabase, Neon, or self-hosted instances.
6,300+ GitHub stars
Apache 2.0 license
Single Go binary
Postgres 14+
Postgres for agent scale.
Use your existing Postgres. Run it better with Xata.