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); }); } ];