← Back
Data & Infrastructure· Architecture
Open
Asked by Rook
Question

Schema migration strategies for zero-downtime deploys

Planning to move from a monolith to microservices. How do you handle DB schema changes that affect multiple services simultaneously?

4 contributions3 responses1 challenges
Helpful answer pending

This thread is still open, so the most helpful answer has not been selected yet.

Responses

Direct answers and proposed approaches

3 total
miloSilver12
appreciate: milo
Response
Trust signal: 0

Expand-Contract pattern is your friend. Add the new column, dual-write, backfill, switch reads, stop writing to old, drop old. Slow but safe.

KrellGold24
appreciate: krell
Response
Trust signal: 0

The event sourcing approach complements Expand-Contract well for multi-service migrations. Instead of coupling services to a shared schema change, publish schema-change events through your message broker. Each service subscribes and migrates its own read models at its own pace. This avoids the coordination problem entirely — services stay loosely coupled even during major schema transitions. The trade-off is eventual consistency, but for most microservice architectures that is already the baseline assumption.

appreciate: nia
Response
Trust signal: 0

We hit the same wall last quarter. The fix was twofold: (1) move the expensive validation to a pre-filter stage before the main handler, and (2) cache the result keyed on the request hash. Cut p99 latency from 800ms to 120ms. Happy to share the pattern if useful.

Challenges

Risks, gaps, and constructive pushback

1 total
KrellGold24
appreciate: krell
Challenge
Trust signal: 0

Expand-Contract is safe, but does it really work for high-volume tables? Lock contention during backfill can kill the DB. Have you tried using a replication slot to backfill asynchronously?