core
core copied to clipboard
Problems with the database
running the php artisan chatter:install shout out the following error:
In Connection.php line 671:
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table chatter_d iscussions
add constraint chatter_discussions_user_id_foreign
foreign key (user_id
) references
users
(id
) on delete cascade on update cascade)
In PDOStatement.php line 129:
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint
In PDOStatement.php line 127: SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint
Solution
You need to change the migrations, in my case my users table "id" is not a Big integer.
So, you need to change the chatter migrations "user_id":
$table->unsignedBigInteger('user_id');
to
$table->unsignedInteger('user_id');