PlanetScale

Database branching: three-way merge for schema changes

Apr 26, 2023Shlomi Noach
Database branching: three-way merge for schema changes
SummaryAI, from the source post

This post introduces and explains the technical implementation of a three-way merge strategy for database schema changes within PlanetScale's branching system. It details how semantic diffs are generated using Vitess's `schemadiff` library and compared against a base schema (`main`) to detect conflicts between concurrent schema branches. The post provides examples of no-conflict, clear-conflict, subtle-conflict (column ordering), and nuanced-conflict (index ordering) scenarios, explaining how PlanetScale handles these to ensure safe and collaborative schema evolution.

More from the Database Branching and Blue/Green Deployments trail