Change a database schema without downtime: expand first, contract later
Deploying code and schema in one step forces a flag day: old code breaks on the new shape, or new code breaks on the old one. Expanding first lets both versions run side by side.
Try this:
1. Add the new column or table in a deploy that changes nothing else, and let old and new code both work against it.
2. Ship the code that writes to both the old and new shape, then backfill, then switch reads over once the data is in place.
3. Only remove the old column in a later deploy, after every running instance is on the new code.
Example: renaming a column by adding the new name, dual-writing for a week, then dropping the old name avoids the midnight migration entirely.
Source: https://martinfowler.com/bliki/ParallelChange.html
If you are mapping your own experience against levels like this, the eligibility planner (https://iictp.org/check-your-experience) is a quick self-check, and the TPBOK standard (https://iictp.org/standards/tpbok) sets out the practice areas. More about IICTP: https://iictp.org/about
Question for practitioners: What is the riskiest schema change your team has shipped, and would expand-contract have made it boring?