Open Justicea83 opened 5 years ago
Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table role_user add constraint role_ user_user_id_foreign foreign key (user_id) references users (id) on delete cascade on update cascade)
role_user
role_ user_user_id_foreign
user_id
users
id
check #941
I think you should edit $table->integer('user_id')->unsigned(); by $table->bigInteger('user_id')->unsigned();. Because on user's migration file use $table->bigIncrements('id');
$table->integer('user_id')->unsigned();
$table->bigInteger('user_id')->unsigned();
$table->bigIncrements('id');
Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table
role_user
add constraintrole_ user_user_id_foreign
foreign key (user_id
) referencesusers
(id
) on delete cascade on update cascade)