📜  一般错误:1215 无法添加外键约束 laravel - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:41.475000             🧑  作者: Mango

代码示例1
Laravel 5.8 Added bigIncrements As Defaults

So there is mismatch in foreign key field types. You see bigIncrements(id) in 
User table and unsigned Integer(user_id) in questions table.

How to fix:

1. Either change original migration from bigIncrements() to just
increments()

2. Or in your foreign key column do unsignedBigInteger() instead of 
unsignedInteger().