Performance: Database migration in production
HIGH IMPACT
This affects the page load speed indirectly by impacting backend response times and database availability during migration.
1. Create migration files locally 2. Use zero-downtime migration techniques like adding nullable columns first 3. Deploy code that uses new columns 4. Backfill data asynchronously 5. Remove old columns in a later migration
python manage.py migrate --noinput
| Pattern | Database Locks | Backend Delay | User Impact | Verdict |
|---|---|---|---|---|
| Direct migration on live DB | Long locks on tables | High backend delay | Slow page load, possible downtime | [X] Bad |
| Zero-downtime staged migration | Minimal or no locks | Low backend delay | Fast page load, no downtime | [OK] Good |