general error 3a 1215 cannot add foreign key constraint laravel

Solutions on MaxInterview for general error 3a 1215 cannot add foreign key constraint laravel by the best coders in the world

showing results for - "general error 3a 1215 cannot add foreign key constraint laravel"
Cali
04 Jan 2021
1Laravel 5.8 Added bigIncrements As Defaults
2
3So there is mismatch in foreign key field types. You see bigIncrements(id) in 
4User table and unsigned Integer(user_id) in questions table.
5
6How to fix:
7
81. Either change original migration from bigIncrements() to just
9increments()
10
112. Or in your foreign key column do unsignedBigInteger() instead of 
12unsignedInteger().
queries leading to this page
laravel pdoexception 3a 3a 28 22sqlstate 5bhy000 5d 3a general error 3a 1215 cannot add foreign ke y constraint 22 29artisan general error 3a 1215 cannot add foreign key constraintgeneral error 3a 1215 cannot add foreign key constraint 22 29 in laravel migrationgeneral error 1215 cannot add foreign key constraint laravel migratelaravel 1215 cannot add foreign key constraintlaravel 8 general error 1215 cannot add foreign key constraintlaravel general error 3a 1215 cannot add foreign key constraint 28sql 3a alter table 60unit 60 add constraint 60laravel error general error 3a 1215 cannot add foreign key constraint laravel general error 3a 1215 cannot add foreign key constraintgeneral error 1215 cannot add foreign key constraint in laravellaravel general error 3a 1215 cannot add foreign key constraint 22 29sqlstate hy000 general error 1215 cannot add foreign key constraint laravel 8laravel eloquent general error 3a 1215 cannot add foreign key constraintsqlstate hy000 general error 1215 cannot add foreign key constraint laravelgeneral error 3a 1215 cannot add foreign key constraint laravel 8general error 1215 cannot add foreign key constraint laravellaravel 8 foreignid sqlstate 5bhy000 5d 3a general error 3a 1215 cannot add foreign key constraintgeneral error 3a 1215 cannot add foreign key constraint laravel 8 migrationlaravel migration 1215 cannot add foreign key constraintgeneral error 3a 1215 cannot add foreign key constraint 22 pivot table laravellaravel 8 eloquent general error 3a 1215 cannot add foreign key constraint1215 cannot add foreign key constraint 28sql 3a alter table 60users 60 add constraint latavel 71215 cannot add foreign key constraint laravellaravel cannot add foreign key constraint 1215laravel sqlstate 5bhy000 5d 3a general error 3a 1215 cannot add foreign key constraintlaravel general error 3a 1215 cannot add foreign key constraint 22general error 3a 1215 cannot add foreign key constraint 2b laravelsqlstate 28hy000 29 3a general error 3a 1215 cannot add foreign key constraint laravel 8general error 3a 1215 cannot add foreign key constraint laravellaravel general error 3a 1215 cannot add foreign key constraint laravel general error 3a 1215 cannot add foreign key constraint 28sql 3a alter table 60unit 60 add constraintgeneral error 1215 cannot add foreign key constraint laravel 71215 cannot add foreign key constraint 28sql 3a alter table 60users 60 add constraint laravel 7general error 3a 1215 cannot add foreign key constraint in laravelgeneral error 1215 cannot add foreign key constraint laravel 8general error 3a 1215 cannot add foreign key constraint laravel migrationsgeneral error 3a 1215 cannot add foreign key constraint laravel