I am building a django app with a MySQL DB. When I run \'python manage.py migrate\' for the first time, some tables are created well then some errors appear. The error broug
Make sure both foreign key and primary key are of the same type.
Foreign key has to be the same type as the primary key of the foreign table. I had a bigint in the foreign table and django did not know how to create a foreign key that was a bigint automatically.
Investigated why the migration was failing by running: python manage.py sqlmigrate {app_name} {migration_name}
Run this in the workbench and you will see the real error behind the failure.
django.db.utils.IntegrityError: (1215, 'Cannot add foreign key constraint')