Most local development setups assume one shared database.
That assumption breaks the moment you start switching Git branches with schema changes.
Migrations collide. Columns disappear. Half-applied states creep in.
You reset, reseed, wait… and lose momentum.
AI coding agents made this worse.
They generate migrations faster than our local workflows were designed to handle. What used to be an occasional annoyance becomes daily friction.
The fix is surprisingly simple:
Run one database per branch.
PostgreSQL can clone a fully seeded database in seconds using CREATE DATABASE ... TEMPLATE. No dumps. No imports. No rebuild cycles.
I wrote a small script to automate the flow — detect the branch, create (or switch to) its database, and update env files.

Top comments (0)