django heroku makemigrations ignoring changes in models

时间秒杀一切 提交于 2019-12-13 00:28:08

问题


I deleted two models from models.py, and when I run makemigrations and migrate locally, everything is fine. When I run makemigrations on Heroku, I get the following message, where Building and BuildingInstance are the models I deleted:

Migrations for 'hello':
0002_building_buildinginstance.py:
- Create model Building
- Create model BuildingInstance

When I run migrate, I get:

Running migrations:
No migrations to apply.
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.

I followed the steps here and also tried squashing the migrations locally and on Heroku as suggested here. How can I fix this problem?


回答1:


As I have written many times here, you must not run makemigrations on Heroku. Run it locally, commit the result, and then​ run migrate on Heroku.



来源:https://stackoverflow.com/questions/43689548/django-heroku-makemigrations-ignoring-changes-in-models

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!