I have a django app running on heroku. I would like to run my South migrations before any code that depends on them goes live. After a quick review of current recommended practices I have found two suggested migration procedures.
heroku run python manage.py migrate <APP_NAME>
for each appThis suffers from having a period in between steps 1 and 2 where my code is assuming the latest schema is in place, but the db hasn't yet been updated.
This solves the previous problem, but adds a lot more complexity to the deployment process, and some day I will mess this up.
It seems that I can avoid the problem in Recommendation 1 and keep my deployment to a single step by utilising a custom post_compile script
that calls python $MANAGE_FILE migrate <APP_NAME>
for each of my apps (in dependency order).
I have not seen this recommended anywhere, so my question is twofold. Can you see any potential problem with this approach, and do you have a better method?
If your application can afford some downtime, the easiest way seems to me to
$ heroku maintenance:on
heroku run python manage.py migrate
$ heroku maintenance:off
Is it enough or do you have more complex needs ?