【发布时间】:2021-07-19 15:22:43
【问题描述】:
我在测试中遇到了一个非常奇怪的错误:
django.db.utils.IntegrityError: null value in column "old_column" violates not-null constraint
E DETAIL: Failing row contains (68, , f, , null, f).
但是“old_column”不再存在于我的数据库中。
它是几个小时前的,但此列已重命名为不同的名称。
如果我使用psql mydb 或manage.py dbshell 检查数据库,然后使用\d appname_tablename 检查数据库,那么我清楚地看到“old_column”不再存在。
我不知道为什么 DB (PostgreSQL) 认为该列仍然存在。
【问题讨论】:
标签: django pytest pytest-django