laravel-achievements
laravel-achievements copied to clipboard
Foreign key in achievement_progress table has incorrect column type
In a MySQL database, the id
field type in the achievement_details
table is UNSIGNED BIG INT
because the $table->id();
command generates an unsigned big int field.
// This generates an UNSIGNED BIG INT column.
$table->id();
In the achievement_progress table
, the achievement_id
field is created as:
$table->unsignedInteger('achievement_id');
That causes a mismatch and MySQL won't create the foreign key.
It should be:
$table->unsignedBigInteger('achievement_id');