Test every migration before it merges
Every pull request gets its own Postgres branch, copied from production or staging. It is created when the pull request opens and deleted when it closes.
Copy-on-write
A branch starts from its parent’s data without copying it.
Its own connection string
Each pull request gets an isolated Postgres database.
Deleted on close
The branch goes away when the pull request merges or closes.
Schema changes are the ones nobody wants to merge blind
Most teams share one staging database. Access gets limited to a few people, the data goes stale, and seed scripts stop matching production. Two pull requests that both change the schema collide there.
Testing a migration on a real copy of the data means a dump and restore that nobody has time for, so the change gets reviewed against data that does not look like production.
A branch copies no data
Creating a branch does not copy your database. The branch reads its parent’s data and keeps only what the pull request changes, so it is ready in about three seconds with the full schema and rows.
Pull request opens
A developer or a coding agent opens a pull request.
A database branch is created
The Xata GitHub App creates a branch from the root branch you picked, staging if you have one and production otherwise, and comments the branch name on the pull request.
Review against real data
Run the migration on the branch with xata roll migrate and point the app at it. Reviewers see the change against the real schema and real rows.
The branch is deleted on close
When the pull request merges or closes, the GitHub App deletes the branch. Nothing is left running.
Two ways to set it up
GitHub App or GitHub Actions
Let the agent open a PR with a database behind it
Your agent can run the whole workflow
Connect the Xata MCP server or install the CLI, and your coding agent can create branches, apply migrations and read schema without touching production.
- Claude Code
- Cursor
- Codex
- VS Code (Copilot)
- Windsurf
- Cline
- OpenCode
- Zed
- Read the guide
Xata for coding agents
CLI, MCP and agent skills in one place.
- Connect MCP
MCP server
Setup for every supported client.
Real data in review, no downtime in production
- Learn more
Real data you are allowed to use
If production holds personal data, copy it into Xata with masking rules applied and branch pull requests from the masked copy.
- Learn more
Ship the migration without downtime
Rehearse the migration on the branch, then apply it to production with pgroll, which serves the old and new schema side by side.
More branching workflows
- Learn more
One branch per preview
A database for every Vercel and Netlify preview.
- Learn more
One branch per CI/CD
A clean database for every test run.
- Learn more
Database Branching
How Xata branches Postgres.
Give every pull request its own database
Run every migration on a branch with real data before it reaches production.