1

In fabfile.py, I use something similar to the following to install dependencies and to migrate the changes to the new model

run("pip install -r ../deployment/pip/deploy.txt")
run("python manage.py migrate --settings=project.settings.prod")

When I upgrade the 3rd party apps which have migrations in the current version, but did not have in the previous one, my understanding is that I have to run ./manage.py migrate --fake <app_name>.

What would be a good solution with which a single deployment script (with Fabric) could pull the code from GIT repo, install new dependencies, take care of migrations and IF there are 3rd party apps that started using migrations recently, then run fake migrations on those.

Any pointers would be highly appreciated.

Thank you

42hrs
  • 11
  • 1
  • 3
  • Call me paranoid, but i dont like to run migrations automatically, things can happen and handling that in an automated script gives me goosebumps. My process is more like this: step one, always add fields never delete/rename/alter in the same migration. You need to delete a field? Fine, just make another migration that does JUST that. Renaming/altering are a real pain in the ass since there is no way to come back from that. I digress. Step two, log into one of the machines and run your migration, nothing should conflict, when thats done. step three, run your deployment. Always works for me. :) – Javier Buzzi Nov 10 '15 at 14:52
  • I agree with you, and already takes care of the points that you have listed in your comment. I'm afraid my question may not have been very clear, but it was about 3rd party apps which have migration files in the latest versions, but didn't have any of those files in the version which was first used with my django project. For example, django-allauth didn't have any migrations in version 0.18 when I started using it with the project, but it's recent version (0.24) which I now upgraded to, have those files. – 42hrs Nov 10 '15 at 17:49
  • Oh i see.. I dont use any 3rd party apps that have migrations so im afraid im in unfamiliar territory. Having said that, i would still NOT handle this in an automated script. If it touches my DB for whatever reason, even if its a table that it uses itself and i dont interact with it directly, i would like to run it myself. -- best of luck. – Javier Buzzi Nov 10 '15 at 19:28

0 Answers0