Bird
0
0

If a migration fails in production due to a locked database, what is the recommended next step?

medium📝 component behavior Q5 of 15
Django - Deployment and Production
If a migration fails in production due to a locked database, what is the recommended next step?
AForce apply migration with --fake
BDelete migration files and rerun makemigrations
CRestart the database and retry migration
DIgnore the error and continue running the app
Step-by-Step Solution
Solution:
  1. Step 1: Identify cause of failure

    Database lock usually means another process is using the DB.
  2. Step 2: Safely resolve lock

    Restarting the database releases locks, allowing migration to proceed.
  3. Final Answer:

    Restart the database and retry migration -> Option C
  4. Quick Check:

    Resolve DB lock by restart = B [OK]
Quick Trick: Restart DB to clear locks before migrating [OK]
Common Mistakes:
MISTAKES
  • Using --fake to skip real migration
  • Deleting migration files in production
  • Ignoring errors and risking data issues

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes