From 732432d00be5e584f7db0aedfbda8372ae11a165 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Fri, 30 Nov 2018 14:04:26 +0100 Subject: [PATCH] Migrations: Fix dropping foreign keys Passing an array to dropForeign does not mean dropping multiple indices, but rather dropping a key on multiple tables. Passing a string means that this string will be interpreted as index name, not as name of the indexed column. Passing an array with one string is therefore correct, in order to benefit from automatic index name generation. --- .../2018_06_27_100700_change_post_likes_add_foreign_keys.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 7136f9e01..fb8e5424b 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 @@ -37,7 +37,8 @@ return [ 'down' => function (Builder $schema) { $schema->table('post_likes', function (Blueprint $table) use ($schema) { - $table->dropForeign(['post_id', 'user_id']); + $table->dropForeign(['post_id']); + $table->dropForeign(['user_id']); Migration::fixIndexNames($schema, $table); });