Adding zero-downtime migrations strategy in SaaS project
summary
Global goal: avoid maintenance windows that can cost up to $66,000 per minute; achieved by making the database compatible with older code rather than forcing old code to change. Uses Django migrations on PostgreSQL and Saleor’s deployment flow with expand and contract pattern: add new columns, backfill via post_migrate background tasks (asynchronous workers process batches, transactional updates with locks), then switch app versions and finally drop old columns. Works for large datasets (millions) by batching, stopping task workers during schema apply, then resuming to finish backfill; only single-version hops are zero-downtime.
AI-written summary · about
chapters (5)
- 0:00Introduction and problem
- 2:56Problematic database operations
- 12:12Expand and contract pattern
- 21:20Version upgrade process
- 24:55Q&A session
related talks
33mDatabase Schema Migrations with Zero Downtime
33mPeaceful Django Migrations with Efe Öge
37mDatabase Schema Migrations with Zero Downtime
29mMigrating Data Quickly and Safely
45mZero-downtime Upgrades
31mSpace Django: Migrating and Redesigning a Database while Hunting for Satellites.
35mDatabase migrations without downtime
32mZero Downtime Deploys Made Easy
