我已经将我的桌子app_a
从app_b
使用db_table
. 我最初添加了元信息,
# app_b.models.ppy
class Table(models.Model)
# all fields
class Meta:
db_table = 'app_a_table'
app_label = 'app_a'
如果我在此表中进行任何更改app_b
,则迁移不会在迁移文件夹下生成新的迁移文件。它说。
No changes detected in app 'app_b'
我从这个答案中尝试过,并发表了评论app_label = 'app_a'
。现在迁移后,它会检测到更改并创建迁移文件。
然后我执行python manage.py migrate
命令,它不断要求删除原始表app_a_table
。
The following content types are stale and need to be deleted:
app_a | table
Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.
Type 'yes' to continue, or 'no' to cancel: no
如何禁止此通知?我如何告诉 django 迁移该表存在于不同的应用程序中?