Skip to content Skip to sidebar Skip to footer

Laravel - Foreign Key Constraint Is Incorrectly Formed

I am trying to create the tables 'teams' and 'competitions' in laravel but when I run the migrate command, I get the following: errno: 150 'Foreign key constraint is incorrectly fo

Solution 1:

You must use same properties for primary key and foreign key

eg. both had ->nullable() or not.

Also, make sure the collation is same for two tables and their columns.

Post a Comment for "Laravel - Foreign Key Constraint Is Incorrectly Formed"