Reputation: 167
I have hosted the django
application in Heroku
environmnet. Whenever I try to initiate migrate command its shows error:
Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
I also checked with new database on same application eventhough same issue. Finally I have tried makemigrations its done well, but after makemigrations also having same issue. The same I have tried with another application
in same heroku
makemigrations and migrate working well.
Please suggest why I can't migrate on previous application in heroku
.
Upvotes: 1
Views: 1801
Reputation: 40
I had the same issue so in resolving it I removed /migrations
dir in .gitignore for the main/master branch (or your own deployment branch). While every other developer's branch has /migrations dir in their .gitignore - so their personal migrations don't get tracked in git.
That way, there'll be minimal chance of having a merge conflict in migrations files, since no developer's migration is tracked in git.
Finally, remember to;
Upvotes: 0
Reputation: 2235
Here two way to solve this problem:
makemigrations
command in Heroku bash.
Run makemigrations locally to create migration files and Run migrate locally then commit the result and push, and then run migrate command on Heroku
.OR
Go to heroku >> your app >> Resources >> select Heroku Postgres >> Settings >> select Destroy Database..
After this follow again first way.
Upvotes: 2