ब्रांचिंग
PyroSQL branching works like Git branches, but for data. A branch is a lightweight, copy-on-write snapshot of the entire database. It can be queried and mutated independently of its parent, then either merged back or discarded — without affecting any other branch.
Because branches use copy-on-write storage, creating a branch is nearly instantaneous and consumes no additional disk space until rows are actually modified on the branch.
Use cases
- Feature branches — develop schema migrations or data transformations in isolation before promoting them to production.
- Staging environments — give each developer or CI job its own live copy of production data without duplicating storage.
- A/B testing — run two variants of an application against diverging data sets and merge the winning variant.
- Safe bulk operations — run a destructive
UPDATEorDELETEon a branch, verify the result, then merge; discard on failure.
PyroBranchManager
PyroBranchManager is the entry point for all branch lifecycle operations. It requires a DBAL connection and a PyroSqlDriver instance, and all its methods assert that the connection is backed by PyroSQL before executing.
use Weaver\ORM\PyroSQL\Branch\PyroBranchManager;
use Weaver\ORM\PyroSQL\PyroSqlDriver;
$driver = new PyroSqlDriver($connection);
$manager = new PyroBranchManager($connection, $driver);