Menu

Database Migrations That Don't Cause Downtime
📰

Database Migrations That Don't Cause Downtime

DEV Community: sql·Luis Lerones·3 days ago
#HHdHajd4
#devtosql#devto#dev#column#table
Long article (1340 words) — no AI summary yet.
Reading 0:00
15s threshold

The worst production incidents we've seen usually came from database migrations that seemed routine, not from bugs. This risk applies whether you're running a single well-organised monolith or a distributed system; in the latter, it tends to compound. A column rename that looked innocuous, a NOT NULL constraint added to a table that turned out to have more rows than anyone had checked, an index that locked a table for twenty minutes during peak traffic.

These are almost always avoidable, and the technique isn't exotic. It's a specific way of thinking about schema changes that most teams never get taught.

The Mental Model: Schema and Code Are Versioned Together

The source of most migration pain is the assumption that schema and code are deployed as a single atomic unit. They aren't. There's always a window (sometimes seconds, sometimes longer) where the running code doesn't match the current schema.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.