Django tests failing to run because they can't create table due to malformed foreign key

浪子不回头ぞ 提交于 2019-12-24 22:46:30

问题


When attempting to run my tests, I get the error in the title. It does not tell me anything remotely useful about which table has failed to be created because the raw output of the error is: django.db.utils.OperationalError: (1005, 'Can\'t create table `test_pogo`.`#sql-269_231` (errno: 150 "Foreign key constraint is incorrectly formed")')

#sql-269_231 gives me absolutely no information as to where I should go and check in my models to find the error, as it is not the name of any of my models or database tables.

When running the project (not the testing modules) locally with my prod copy, everything seems to work as expected.

How do I find and fix the broken model?

来源:https://stackoverflow.com/questions/58277434/django-tests-failing-to-run-because-they-cant-create-table-due-to-malformed-for

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