Zero downtime Laravel migrations
Aug 29, 2022Holly Guevara

Summary
This post details how to achieve zero downtime Laravel migrations by leveraging PlanetScale's database branching and online schema change capabilities. It explains the dangers of direct DDL during deployment, the mechanics of non-blocking schema changes (shadow tables, atomic swaps), and provides detailed workflows for adding/dropping columns/tables and renaming columns/tables. It also covers the bonus feature of reverting schema changes within a 30-minute window by keeping the old table around and syncing data back, and clarifies that Laravel migrations should only be run on development environments connected to PlanetScale development branches, not production.