r/SQL • u/sqlink2 • Aug 12 '26
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
2
u/Content-Parking-621 Aug 12 '26
The main thing to understand is that Lakebase branches are for testing, not merging. You build and test the schema changes on a branch, then run those same changes on main. If another team changes production while you're working, use the Schema diff on the child branch's overview page to see what's different. Then create a new branch from the updated production and test again. Keep your migrations as versioned SQL files so main stays the source of truth, instead of relying on an old branch.
1
u/ThisIsFun- Aug 12 '26
Yeah, this is expected since the Lakebase branches are isolated after you create them. I wouldn’t try to keep long-lived branches manually in sync.
What has worked better us is keeping all schema changes as migrations in the repo. Make the change on the feature branch, test it there, then apply the same migration to the main/dev branch when the feature is ready.
1
u/Glitch_In_The_Data Aug 12 '26
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/BrunoFeliz08 Aug 14 '26
When using lakebase i usually use schema evolution for branch merges and my pipelines. However my pipelines rn come from unity catalog with synced tables
1
u/[deleted] Aug 12 '26
[removed] — view removed comment