Skip to content

Commit

Permalink
Merge pull request #106 from dwyl/master
Browse files Browse the repository at this point in the history
Fixes #80 : foreign key error message in migration now compatible with Laravel 5.8
  • Loading branch information
overtrue committed May 26, 2019
2 parents adfe884 + fff0e16 commit 97b40d8
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -21,7 +21,15 @@ public function up()
{
Schema::create(config('follow.followable_table', 'followables'), function (Blueprint $table) {
$userForeignKey = config('follow.users_table_foreign_key', 'user_id');
$table->unsignedInteger($userForeignKey);

// Laravel 5.8 session user is unsignedBigInteger
// https://github.com/laravel/framework/pull/28206/files
if ((float) app()->version() >= 5.8) {
$table->unsignedBigInteger($userForeignKey);
} else {
$table->unsignedInteger($userForeignKey);
}

$table->unsignedInteger('followable_id');
$table->string('followable_type')->index();
$table->string('relation')->default('follow')->comment('follow/like/subscribe/favorite/upvote/downvote');
Expand Down

0 comments on commit 97b40d8

Please sign in to comment.