A developer’s guide to branching
A database branch gives you an isolated environment to test schema changes before applying them to production. Here’s how to use one while working on a Supabase app.
Set up a branch for your change
Suppose you’re adding a delivery address to checkout. You need a new table, an access policy, and a migration. Test them together in a branch before changing the production database.
Connect your local app or preview deployment to the branch. Check its connection settings before running migrations, then load test fixtures for the cases you need to cover.
| Step | What to verify |
|---|---|
| Isolate | The preview cannot write to production |
| Seed | Fixtures cover realistic edge cases |
| Migrate | Schema changes apply cleanly |
| Exercise | Queries and access policies still work |
Check queries and access policies
Create two test users. Check that each can read and update their own address, but cannot access the other user’s address. Also check what happens when a request has no authenticated user.
Review the migration and remove the branch
Commit the migration with the application code so both can be reviewed in the same PR. Check the production rollout plan before merging. Once testing is finished, remove the temporary branch and its credentials.

