【问题标题】:django heroku makemigrations ignoring changes in modelsdjango heroku makemigrations 忽略模型的变化
【发布时间】:2017-09-27 02:58:23
【问题描述】:

我从 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 的步骤操作,还尝试按照here 的建议在本地和 Heroku 上压缩迁移。我该如何解决这个问题?

【问题讨论】:

  • 您只有一个default 数据库还是您使用的是数据库路由器?
  • @Grimmy 仅默认
  • 检查django_migrations 表的内容通常会有所帮助。也许有些东西不同步。

标签: python django heroku django-models heroku-postgres


【解决方案1】:

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

【讨论】:

  • 当我按照这些步骤操作时,我仍然遇到同样的错误
猜你喜欢
  • 2021-12-20
  • 2018-09-09
  • 1970-01-01
  • 2019-12-31
  • 1970-01-01
  • 2017-11-20
  • 1970-01-01
  • 2021-07-07
  • 2022-01-15
相关资源
最近更新 更多