perf: add missing indexes for session filtering and sorting

- Add compound index on (companyId, language) for language filtering
- Add compound index on (companyId, messagesSent) for message count sorting
- Add compound index on (companyId, avgResponseTime) for response time sorting

These indexes optimize the session dashboard queries that filter by language
or sort by messagesSent/avgResponseTime, preventing full table scans.
This commit is contained in:
2025-06-28 21:18:11 +02:00
parent f5c2af70ef
commit 86498ec0df

View File

@ -147,6 +147,9 @@ model Session {
@@index([companyId, category]) @@index([companyId, category])
@@index([companyId, escalated]) @@index([companyId, escalated])
@@index([companyId, forwardedHr]) @@index([companyId, forwardedHr])
@@index([companyId, language])
@@index([companyId, messagesSent])
@@index([companyId, avgResponseTime])
} }
/// * /// *