As coding agents work in parallel, shared development databases can become a bottleneck. Lakebase database branching gives each agent or pull request an isolated Postgres environment for schema changes, testing, and preview workflows, without affecting the parent branch.
Key Highlights
- Create isolated databases per agent: Lakebase branches use copy-on-write storage, inherit the parent schema and data, and can be created without making a full database copy.
- Keep branches lightweight: Branch compute can scale to zero when idle, and expiring branches only store the data that changes, making short-lived environments practical for parallel work.
- Connect code and database isolation: Combine Git worktrees with a post-checkout hook so each agent gets its own code directory and Lakebase branch. The Lakebase-Agentic-CI example demonstrates this workflow.
- Create an ephemeral database for every PR: GitHub Actions can create a branch, run Drizzle or another migration tool, deploy a preview app with Databricks Apps, generate a schema diff, and remove the branch when the PR is closed or merged.
- Test safely against realistic data: Create branches from a point in time to reproduce bugs, validate schema migrations, or test application behavior without changing the live database. Use an appropriate seeded source and data masking when production-derived data includes sensitive information.
- Promote migrations through code: Lakebase branches are isolated environments rather than branches that are merged back. Track schema changes in the repository and apply tested migrations to the parent branch with tools such as Drizzle, Flyway, Liquibase, or Alembic.
๐ Read the full story here