Laravel 5.2 Entrust migrate error, cannot add foreign key constraints

Viewed 2131

I installed and configure the Laravel 5.2, its working fine, for User ACL I installed the zizaco/entrust package while running this command php artisan migrate (for creating roles, permissions table etc) getting following error

[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 `` (id) on delete cascade on update cascade)

[PDOException] SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint

What could be the reason ? am I missing something ? I followed the step wise guideline from entrust site

3 Answers

If U Use All Other Solution that given in GitHub or StackOverflow and not resolve your issue then delete users table from database admin panel and make some changes in the users migration file. Change the bigIncrements('id'); to Increment('id'). Or Goto Database admin panel like if you use MySQL goto PHPmyadmin panel here goto database and then users here change the datatype of id from bigint(20) into int(10).

Related