From 2ecc314434fde5a2859125c09bdc10bdc5ca4d6a Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 6 Oct 2022 22:32:26 -0600 Subject: [PATCH 1/2] Update PublicApiController, remove expensive and unused relationships --- app/Http/Controllers/PublicApiController.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 2eb7a9b49..2d4a71bdd 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -364,7 +364,6 @@ class PublicApiController extends Controller ) ->whereNull(['in_reply_to_id', 'reblog_of_id']) ->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album']) - ->with('profile', 'hashtags', 'mentions') ->whereLocal(true) ->whereScope('public') ->orderBy('id', 'desc') @@ -517,7 +516,6 @@ class PublicApiController extends Controller ->when($textOnlyReplies != true, function($q, $textOnlyReplies) { return $q->whereNull('in_reply_to_id'); }) - ->with('profile', 'hashtags', 'mentions') ->where('id', $dir, $id) ->whereIn('profile_id', $following) ->whereIn('visibility',['public', 'unlisted', 'private']) @@ -564,7 +562,6 @@ class PublicApiController extends Controller ->when(!$textOnlyReplies, function($q, $textOnlyReplies) { return $q->whereNull('in_reply_to_id'); }) - ->with('profile', 'hashtags', 'mentions') ->whereIn('profile_id', $following) ->whereIn('visibility',['public', 'unlisted', 'private']) ->orderBy('created_at', 'desc') From 923dfdbaaa58d6778f0aaddf2d192b78d945ac88 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 6 Oct 2022 23:12:12 -0600 Subject: [PATCH 2/2] Add migration --- ...d_reblog_of_id_index_to_statuses_table.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 database/migrations/2022_10_07_045520_add_reblog_of_id_index_to_statuses_table.php diff --git a/database/migrations/2022_10_07_045520_add_reblog_of_id_index_to_statuses_table.php b/database/migrations/2022_10_07_045520_add_reblog_of_id_index_to_statuses_table.php new file mode 100644 index 000000000..85a055558 --- /dev/null +++ b/database/migrations/2022_10_07_045520_add_reblog_of_id_index_to_statuses_table.php @@ -0,0 +1,38 @@ +getDoctrineSchemaManager(); + if(array_key_exists('statuses_in_reply_or_reblog_index', $sc)) { + $table->dropIndex('statuses_in_reply_or_reblog_index'); + } + + $table->index('in_reply_to_id'); + $table->index('reblog_of_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('statuses', function (Blueprint $table) { + // + }); + } +}