From b76db5c774b8ed572c1e01d0bc4db40826eab05f Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Fri, 12 Sep 2025 09:51:09 +0200 Subject: [PATCH] Add composite indexes --- .../2025_09_12_073227_add_new_indexes.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 database/migrations/2025_09_12_073227_add_new_indexes.php diff --git a/database/migrations/2025_09_12_073227_add_new_indexes.php b/database/migrations/2025_09_12_073227_add_new_indexes.php new file mode 100644 index 000000000..981993446 --- /dev/null +++ b/database/migrations/2025_09_12_073227_add_new_indexes.php @@ -0,0 +1,29 @@ +index(['likeable_id', 'likeable_type']); + $table->index(['likeable_id', 'likeable_type', 'created_at']); + }); + + Schema::table('taggables', function (Blueprint $table) { + $table->dropIndex(['taggable_id']); + + $table->index(['taggable_id', 'taggable_type']); + }); + + Schema::table('replies', function (Blueprint $table) { + $table->dropIndex(['replyable_id']); + $table->dropIndex(['replyable_type']); + + $table->index(['replyable_id', 'replyable_type']); + }); + } +};