thedevdojo / chatter

Chatter is a Simple Laravel Forum Package
https://devdojo.com/forums
MIT License
897 stars 295 forks source link

Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1005 Can't create table `test`.`#sql-774_e8` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `chatter_discussion` add constraint `chatter_discussion_chatter_category_id_foreign` foreign key (`chatter_category_id`) references `chatter_categories` (`id`) on delete cascade on update cascade) #257

Open enzodpaiva opened 4 years ago

enzodpaiva commented 4 years ago

how i resolve this ?

moseskamau338 commented 4 years ago

I ha the same problem but I discovered it's an issue regarding the data types assigned in the schemas. In my case, the user id in the users table used $table->bigIncrements('id'), I just changed that to $table->increments('id'). All is well now :)

arslanramay commented 4 years ago

I ha the same problem but I discovered it's an issue regarding the data types assigned in the schemas. In my case, the user id in the users table used $table->bigIncrements('id'), I just changed that to $table->increments('id'). All is well now :)

This helped to resolve my issue. Thanks a lot :)