fix(db): unique index parcial em inbox_messages.whatsapp_message_id - #64
fix(db): unique index parcial em inbox_messages.whatsapp_message_id#64felipetruman wants to merge 1 commit into
Conversation
Companion no nível do banco da guard app-level (thaleslaray#58). O índice do baseline era não-unique (só performance), permitindo duplicatas em retries do Meta. Troca por UNIQUE INDEX parcial (WHERE whatsapp_message_id IS NOT NULL), garantindo dedup no DB mesmo se a guard app-level falhar. Inclui nota de deduplicação prévia para bases já em uso (UNIQUE falha se houver duplicatas existentes).
|
@felipetruman is attempting to deploy a commit to the Thales Laray Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA single Supabase SQL migration drops the existing non-unique index on ChangesWhatsApp Message Deduplication Index
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contexto
Companion no nível do banco do PR #58 (guard app-level de dedup inbound). O índice do baseline em
whatsapp_message_idera não-unique (só performance), então retries do Meta conseguiam inserir a mesma mensagem 2x.Correção
idx_inbox_messages_whatsapp_msg_id(não-unique).ux_inbox_messages_whatsapp_msg_id— UNIQUE INDEX parcialWHERE whatsapp_message_id IS NOT NULL.A criação do UNIQUE falha se houver duplicatas existentes. Instalações novas têm a tabela vazia. Para bases em uso, deduplicar antes (snippet de
DELETEcomrow_number()no header da migration).Test plan
Summary by CodeRabbit