[Django]-How to manage version controlled Django migrations as a team?


Using version control (git, etc.) will solve your problem.

Just make sure the developers work on a branch rather than directly on master. This way, the migrations will be visible, and if there’s a conflict, git will let you know when you try to merge to your master branch. It’s even more obvious if you’re using GitHub as you can see the conflicts in the UI for the pull request.

The only problem you will have here is if two migrations are generated in the same app in two PRs. The one that gets merged into master last will cause a problem as there will be multiple leaf nodes, but this can be solved easily with ./manage.py makemigrations --merge, and ideally you should run ./manage.py makemigrations --check to see if there are problems before merging stuff – in continuous integration, for exaple.

Leave a comment