Incompatible foreign key when attempting to link tables in Django?

29 views
Skip to first unread message

Shada Bahassan

unread,
Jul 6, 2022, 5:03:44 AM7/6/22
to Django users
SQLSTATE[HY000]: General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key are incompatible

I'm trying to make a couple basic models , and link them with foreign Key. See the below attach:
foreign#1.PNG
foriegn#2.PNG
I migrated two table (model)  individual and then I tried to make the reference via foreign key. but It doesn't work, I get the following error :foreign#3.PNG 
I cannot figure out why this is happening because the referencing tool is successfully referencing multiple other tools, but it will not link to this one. What is the reason for this error? And how can I fix it so that I can link the tables? Why are they incompatible?=
Reply all
Reply to author
Forward
0 new messages