lundi 7 octobre 2019

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

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?

Aucun commentaire:

Enregistrer un commentaire