[BUG] Foreign key constraint error after artisan migrate on Laravel 5.8
Closed this issue · 2 comments
nafiesl commented
A facebook friend named Adhik Mulat, inform that he got following error (foreign key constraint) when on artisan migrate
command after generate a model CRUD.
This happened because in laravel 5.8 the default users table migration uses bigIncrement data type on id column. But in generated migration file (like image below) the foreign user_id colum still using integer (not big integer).
Laravel 5.8 users table migration file
Generated migration file
nafiesl commented
To solve this problem, we need to change the migration file stub.
This line need to changed into
$table->unsignedBigInteger('creator_id');