Expand description
Ephemeral shadow branches.
The shadow source database — a Docker container’s init database, or the
database named in shadow.url — is treated as a read-only baseline that
pgmt never writes to. Each run works on a branch: a CREATE DATABASE ... TEMPLATE source copy that is dropped again at process exit. The source
stays pristine by construction, every branch starts from the current
baseline, and on external servers cleanup leaves things exactly as pgmt
found them.
Functions§
- admin_
db_ name - Maintenance database for CREATE/DROP DATABASE: those statements cannot run from the database being copied or dropped.
- branch_
url - Branch an external
shadow.urlsource (declaredreset: branch) and return the connection string for the branch. The named database itself is never touched. - cleanup_
all_ branches - Drop every branch this process created. Called at process exit, while any warm shadow containers are still running.
- create_
branch - Create an ephemeral branch of
source_dband register it for drop at process exit. The source must have no active connections (PostgreSQL requires this ofCREATE DATABASE ... TEMPLATE); pgmt itself never connects to it. - drop_
branch - Drop the ephemeral branch a pool is connected to, reclaiming it as soon as a phase finishes instead of holding every branch until process exit.