From b8a6c9d0c2dac9bd0982413beee4364663cbe0ac Mon Sep 17 00:00:00 2001 From: pllx Date: Tue, 30 Jun 2026 11:38:38 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=BC=96=E5=86=99=E5=B9=B6=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=81=E7=A7=BB=EF=BC=8C?= =?UTF-8?q?=E4=B8=BA=20messages=20=E8=A1=A8=E6=B7=BB=E5=8A=A0=20(room=5Fid?= =?UTF-8?q?,=20sent=5Fat)=20=E8=81=94=E5=90=88=E7=B4=A2=E5=BC=95=E4=BB=A5?= =?UTF-8?q?=E6=B6=88=E9=99=A4=E6=85=A2=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0_add_compound_index_to_messages_table.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 database/migrations/2026_06_30_114000_add_compound_index_to_messages_table.php diff --git a/database/migrations/2026_06_30_114000_add_compound_index_to_messages_table.php b/database/migrations/2026_06_30_114000_add_compound_index_to_messages_table.php new file mode 100644 index 0000000..048b2cc --- /dev/null +++ b/database/migrations/2026_06_30_114000_add_compound_index_to_messages_table.php @@ -0,0 +1,37 @@ +index(['room_id', 'sent_at'], 'idx_room_sent_at'); + }); + } + + /** + * 回滚迁移,删除联合索引 + */ + public function down(): void + { + Schema::table('messages', function (Blueprint $table) { + $table->dropIndex('idx_room_sent_at'); + }); + } +};