Skip to content

[messages] optimize database indexes - #267

Open
capcom6 wants to merge 2 commits into
masterfrom
messages/optimize-database-indexes
Open

[messages] optimize database indexes#267
capcom6 wants to merge 2 commits into
masterfrom
messages/optimize-database-indexes

Conversation

@capcom6

@capcom6 capcom6 commented Aug 17, 2026

Copy link
Copy Markdown
Member

Greptile Summary

The PR optimizes message lookup indexes and aligns the GORM model metadata with the new composite indexes. It also documents the intentional temporary use of the deprecated FCM token field.

  • Adds indexes for message creation time and device-scoped creation time.
  • Replaces the single-column hash-status index with a composite processing index.
  • Adds a targeted staticcheck suppression pending FID migration.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
internal/sms-gateway/models/migrations/mysql/20260817000000_optimize_messages_indexes.sql Adds and reverses the optimized message indexes consistently, including restoration of the prior hash-status index.
internal/sms-gateway/modules/messages/models.go Aligns GORM metadata and composite-index column priorities with the migration.
internal/sms-gateway/modules/push/fcm/client.go Adds a scoped lint suppression documenting the planned migration from the deprecated token field.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Q1[Created-at queries] --> I1[idx_messages_created_at]
  Q2[Device history queries] --> I2[idx_messages_device_created_at]
  Q3[Unhashed message processing] --> I3[idx_messages_unhashed]
  I3 --> C1[is_hashed]
  I3 --> C2[is_encrypted]
  I3 --> C3[state]
Loading

Reviews (4): Last reviewed commit: "[lint] ignore FCM Fid migration" | Re-trigger Greptile

@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

🤖 Pull request artifacts

Platform File
🐳 Docker GitHub Container Registry
🍎 Darwin arm64 server_Darwin_arm64.tar.gz
🍎 Darwin x86_64 server_Darwin_x86_64.tar.gz
🐧 Linux arm64 server_Linux_arm64.tar.gz
🐧 Linux i386 server_Linux_i386.tar.gz
🐧 Linux x86_64 server_Linux_x86_64.tar.gz
🪟 Windows arm64 server_Windows_arm64.zip
🪟 Windows i386 server_Windows_i386.zip
🪟 Windows x86_64 server_Windows_x86_64.zip

@capcom6
capcom6 force-pushed the messages/optimize-database-indexes branch from 86f27be to d9aa9ed Compare August 18, 2026 01:22
@capcom6 capcom6 added the ready label Aug 19, 2026
@capcom6
capcom6 force-pushed the messages/optimize-database-indexes branch from d9aa9ed to 40ab81a Compare August 20, 2026 00:59
@github-actions github-actions Bot removed the ready label Aug 20, 2026
@capcom6 capcom6 added the ready label Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant