Zizaco / entrust

Role-based Permissions for Laravel 5
MIT License
6.05k stars 1.29k forks source link

cannot add foreign key constaint #952

Open Justicea83 opened 5 years ago

Justicea83 commented 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)

bjsmasth commented 5 years ago

check #941

tanhit243 commented 4 years ago

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