## Description This PR optimizes message queries by explicitly filtering with `account_id` so the database can use the existing indexes more efficiently. Changes: - Add `account_id` to message query filters to improve index utilization. - Update `last_incoming_message` query to include `account_id`. - Avoid unnecessary preloading of `contact_inboxes` where it is not required. - Update specs to ensure `account_id` is set correctly in message-related tests. These changes reduce query cost and improve performance for message lookups, especially on large accounts. --------- Co-authored-by: Pranav <pranav@chatwoot.com> |
||
|---|---|---|
| .. | ||
| captain | ||
| cloudflare | ||
| companies | ||
| contacts | ||
| enterprise | ||
| internal | ||
| llm | ||
| messages | ||
| sla | ||
| twilio | ||
| voice | ||