Home Software Consultant

Django migration timeout


We had a table having more than 6 lakh records. Everytime we added a new field to the model, and ran the migration we got timeout. So, we did the following 3 step procedure 1) Opened psql with timeout options -

PGOPTIONS="-c statement_timeout=0" psql -U name

  1. We extracted the sql to be executed in psql from south

manage.py migrate --db-dry-run --verbosity=2

  1. Then, ran the migration command with fake option

python manage.py migrate modelname --fake