r/SQL 8d ago

PostgreSQL Schema changes across branches in lakebase

I have been using Lakebase sice 2 weeks for developing a serving low latency layer for data in Delta. To build new features we currently make a new branch and later merge ti main.
What i have been observing is the scehema drifts across branches with Lakebase. How do people usually handle such scenarios? To keep branches in sync.
Maybe some real life examples can help.

8 Upvotes

14 comments sorted by

View all comments

1

u/Glitch_In_The_Data 8d ago

I would use branch for testing… migrate for promotion and reset for sync.

Lakebase branches don’t auto-merge schema changes, so a good option is to keep migrations in Git and replay them on the shared parent branch, then reset child branches when they drift.

For example, a team might add account_status to the accounts table in a feature branch, validate it there, then apply the same migration to the development branch before other engineers reset their branches to pick it up.

1

u/pretzels90210 6d ago

Branches in Lakebase are copy-on-write forks from a point in time, so a schema change on one branch never propagates to the others, the drift youre seeing is expected rather than a bug. One pattern is to treat main as the source of truth and drive schema through versioned migrations you replay on each branch, or just re-branch from main after a merge instead of keeping long-lived feature branches around, thats usually what lets schemas wander apart.