📜  语法错误或访问冲突:1072 表中不存在键列“user_id”(SQL:更改表`groups`添加约束`groups_user_id_foreign`外键(`user_id`)引用`users`(`id`)) - PHP代码示例

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

代码示例1
// You forgot to create the column before creating the relationship
// Do something like (add unsigned before the relationship):

$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users');