(I know there is a title the same as this, but the question is different).
I have managed to get my development machine migrations and production migrations out of sync.
I have a Django app which was using South. I had my own workflow that worked fine (it probably wasn't the correct way to do things, but I had no problems with it).
Basically I have a script that copies the production database dump to my development machine. It also copied the migration files. That way the two were in synch, and I could run South commands as normal.
Now I have upgraded to 1.7, and started using migrations. When I use my previous workflow (copy database dump, and migration files from production), it is not detecting changes on my development machine.
I have read through the migrations document, and I see that the correct way to use it is to
Anyway. It is all a mess now. I would like to "reset" my migrations and start from scratch, doing things properly from now on.
What do I need to do?
Have I missed anything? Is there a reason why copying everything from production(database and migration files) doesn't detect any changes on my development machine afterwards
I would just do the following on both the environments (as long as the code is the same)
<your app name>
. You could alternatively just truncate this table.python manage.py makemigrations
python manage.py migrate --fake
After this all your changes should get detected across environments.
This sounds more or less like what I did in the end. I tried deleting (well actually renaming the django_migrations table). Then I discovered some app migrations depended on others, so I repopulated those entries in the new django_migrations table.
I've seen so many answers to similar questions that make this more complicated than it needs to be. This is the way to do it. Clean and simple.
Now Django won't detect any new changes; ie adding a table. any ideas?
I did this but, like Turtles Are Cute, kept getting "No changes detected" (Django 1.10). The solution was to run
makemigrations
specifying the app. e.g.,python manage.py makemigrations polls
if your app is calledpolls
.python manage.py flush --no-input
to avoid no action after typing yes to continue