mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-18 11:22:21 -06:00
refactor: Add indexes to improve performance in ChatwootService
This commit is contained in:
@@ -125,6 +125,8 @@ model Chat {
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
unreadMessages Int @default(0)
|
||||
@@index([instanceId])
|
||||
@@index([remoteJid])
|
||||
}
|
||||
|
||||
model Contact {
|
||||
@@ -138,6 +140,8 @@ model Contact {
|
||||
instanceId String
|
||||
|
||||
@@unique([remoteJid, instanceId])
|
||||
@@index([remoteJid])
|
||||
@@index([instanceId])
|
||||
}
|
||||
|
||||
model Message {
|
||||
@@ -164,6 +168,7 @@ model Message {
|
||||
|
||||
sessionId String?
|
||||
session IntegrationSession? @relation(fields: [sessionId], references: [id])
|
||||
@@index([instanceId])
|
||||
}
|
||||
|
||||
model MessageUpdate {
|
||||
@@ -178,6 +183,8 @@ model MessageUpdate {
|
||||
messageId String
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
@@index([instanceId])
|
||||
@@index([messageId])
|
||||
}
|
||||
|
||||
model Webhook {
|
||||
@@ -192,6 +199,7 @@ model Webhook {
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
@@index([instanceId])
|
||||
}
|
||||
|
||||
model Chatwoot {
|
||||
@@ -260,6 +268,7 @@ model Setting {
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
@@index([instanceId])
|
||||
}
|
||||
|
||||
model Rabbitmq {
|
||||
|
||||
Reference in New Issue
Block a user