From a54f1e2bc5f7b8405f6757b2d50256d8fad93d47 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 27 Nov 2018 22:33:32 +1030 Subject: [PATCH] Fix index names in migrations This can be reverted when we upgrade to Laravel 5.7. --- ...8_06_27_100700_change_post_likes_add_foreign_keys.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/extensions/likes/migrations/2018_06_27_100700_change_post_likes_add_foreign_keys.php b/extensions/likes/migrations/2018_06_27_100700_change_post_likes_add_foreign_keys.php index c11762096..7136f9e01 100644 --- a/extensions/likes/migrations/2018_06_27_100700_change_post_likes_add_foreign_keys.php +++ b/extensions/likes/migrations/2018_06_27_100700_change_post_likes_add_foreign_keys.php @@ -9,6 +9,7 @@ * file that was distributed with this source code. */ +use Flarum\Database\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Builder; @@ -26,15 +27,19 @@ return [ }) ->delete(); - $schema->table('post_likes', function (Blueprint $table) { + $schema->table('post_likes', function (Blueprint $table) use ($schema) { $table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade'); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + + Migration::fixIndexNames($schema, $table); }); }, 'down' => function (Builder $schema) { - $schema->table('post_likes', function (Blueprint $table) { + $schema->table('post_likes', function (Blueprint $table) use ($schema) { $table->dropForeign(['post_id', 'user_id']); + + Migration::fixIndexNames($schema, $table); }); } ];