gpt4 book ai didi

python - django heroku makemigrations 忽略模型中的更改

转载 作者:太空宇宙 更新时间:2023-11-03 15:18:32 28 4
gpt4 key购买 nike

我从 models.py 中删除了两个模型,当我运行 makemigrations 并在本地迁移时,一切都很好。当我在 Heroku 上运行 makemigrations 时,收到以下消息,其中 Building 和 BuildingInstance 是我删除的模型:

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

当我运行迁移时,我得到:

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.

我按照步骤here进行操作并尝试按照建议在本地和 Heroku 上压缩迁移 here 。我该如何解决这个问题?

最佳答案

正如我在这里多次写过的,您不得在 Heroku 上运行 makemigrations。在本地运行它,提交结果,然后在 Heroku 上运行 migrate。

关于python - django heroku makemigrations 忽略模型中的更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43689548/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com