entrust icon indicating copy to clipboard operation
entrust copied to clipboard

cannot add foreign key constaint

Open Justicea83 opened this issue 5 years ago • 3 comments

Justicea83 avatar Jul 25 '19 10:07 Justicea83

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)

Justicea83 avatar Jul 25 '19 10:07 Justicea83

check #941

bjsmasth avatar Jul 27 '19 16:07 bjsmasth

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');

tanhit243 avatar Oct 17 '19 08:10 tanhit243