pglifecycle¶
A PostgreSQL schema management tool.
pglifecycle keeps your database schema in a version-controlled project of YAML files — one file per database object — and moves schema between the repository and live databases:
pullreads a live database (or apg_dumparchive) and writes the project directory.buildturns the project into apg_restore-compatible custom format archive.createscaffolds an empty project.
The project format is validated against JSON-Schema definitions for every PostgreSQL object type, so the repository is the contract: tables, columns, constraints, indexes, functions, ACLs, and roles are structured data, not opaque SQL.
Installation¶
Homebrew (macOS / Linux)¶
pglifecycle is published in the shared gmr/postgres tap:
Note
Homebrew 6.0 added tap trust, and
some versions fail to install third-party taps inside the build
sandbox (the error mentions build.rb ... exited with 1). If you
hit this, trust the formula first with
brew trust --formula gmr/postgres/pglifecycle, or set
HOMEBREW_NO_REQUIRE_TAP_TRUST=1 for the install.
Cargo¶
Release binaries¶
Prebuilt binaries for Linux and macOS (x86_64 and aarch64) are attached to each GitHub release.
Quick start¶
Pull an existing database into a new project:
Build the project into a restorable archive:
Or start from scratch:
See Commands for the full reference and Project Format for the directory layout.