From 7a789f83577b81bf42f8d43e50882ec9157ba37b Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Tue, 26 Aug 2025 19:55:39 -0400 Subject: [PATCH 1/2] FOUR-25374 --- ...ted_at_index_to_process_request_tokens.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 database/migrations/2025_08_26_130002_add_created_at_index_to_process_request_tokens.php diff --git a/database/migrations/2025_08_26_130002_add_created_at_index_to_process_request_tokens.php b/database/migrations/2025_08_26_130002_add_created_at_index_to_process_request_tokens.php new file mode 100644 index 0000000000..4a765ec496 --- /dev/null +++ b/database/migrations/2025_08_26_130002_add_created_at_index_to_process_request_tokens.php @@ -0,0 +1,27 @@ +index('created_at', 'idx_process_request_tokens_created_at'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('process_request_tokens', function (Blueprint $table) { + $table->dropIndex('idx_process_request_tokens_created_at'); + }); + } +}; From 602f6ea7f8fdcd96a0800a07bc0870856bb8b245 Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Tue, 28 Oct 2025 21:13:26 -0400 Subject: [PATCH 2/2] FOUR-25374: Updating as DBA request --- ...2_add_created_at_index_to_process_request_tokens.php} | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) rename database/migrations/{2025_08_26_130002_add_created_at_index_to_process_request_tokens.php => 2025_10_28_130002_add_created_at_index_to_process_request_tokens.php} (66%) diff --git a/database/migrations/2025_08_26_130002_add_created_at_index_to_process_request_tokens.php b/database/migrations/2025_10_28_130002_add_created_at_index_to_process_request_tokens.php similarity index 66% rename from database/migrations/2025_08_26_130002_add_created_at_index_to_process_request_tokens.php rename to database/migrations/2025_10_28_130002_add_created_at_index_to_process_request_tokens.php index 4a765ec496..e58652f7bd 100644 --- a/database/migrations/2025_08_26_130002_add_created_at_index_to_process_request_tokens.php +++ b/database/migrations/2025_10_28_130002_add_created_at_index_to_process_request_tokens.php @@ -8,11 +8,10 @@ /** * Run the migrations. */ - public function up(): void + public function up() { - Schema::table('process_request_tokens', function (Blueprint $table) { - $table->index('created_at', 'idx_process_request_tokens_created_at'); - }); + // Create descending index on created_at for optimized queries + DB::statement('CREATE INDEX idx_process_request_tokens_created_at_desc ON process_request_tokens (created_at DESC)'); } /** @@ -21,7 +20,7 @@ public function up(): void public function down(): void { Schema::table('process_request_tokens', function (Blueprint $table) { - $table->dropIndex('idx_process_request_tokens_created_at'); + $table->dropIndex('idx_process_request_tokens_created_at_desc'); }); } };