更新时间:2023-12-01 09:39:16
这是因为您在迁移文件中添加了$table->integer('user_id');
.您必须添加unsignedInteger
而不是integer
,因为users
表的原始id
列为unsigned
(并且两列必须完全相同).
This is because you added $table->integer('user_id');
to your migration file. You must add an unsignedInteger
instead of an integer
, because the original id
column of the users
table is unsigned
(and both columns must be exactly the same).
从Laravel 5.8开始,默认users
表的id
列类型不再是integer
.现在是bigInteger
.
Since Laravel 5.8, the id
column type of the default users
table is no longer an integer
. It is now a bigInteger
.