mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-18 19:32:21 -06:00
refactor: Add indexes to improve performance in ChatwootService
This commit is contained in:
@@ -124,6 +124,9 @@ model Chat {
|
||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
unreadMessages Int @default(0)
|
||||
@@index([instanceId])
|
||||
@@index([remoteJid])
|
||||
}
|
||||
|
||||
model Contact {
|
||||
@@ -137,6 +140,8 @@ model Contact {
|
||||
instanceId String
|
||||
|
||||
@@unique([remoteJid, instanceId])
|
||||
@@index([remoteJid])
|
||||
@@index([instanceId])
|
||||
}
|
||||
|
||||
model Message {
|
||||
@@ -164,6 +169,7 @@ model Message {
|
||||
|
||||
sessionId String?
|
||||
session IntegrationSession? @relation(fields: [sessionId], references: [id])
|
||||
@@index([instanceId])
|
||||
}
|
||||
|
||||
model MessageUpdate {
|
||||
@@ -178,6 +184,8 @@ model MessageUpdate {
|
||||
messageId String
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
@@index([instanceId])
|
||||
@@index([messageId])
|
||||
}
|
||||
|
||||
model Webhook {
|
||||
@@ -192,6 +200,7 @@ model Webhook {
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
@@index([instanceId])
|
||||
}
|
||||
|
||||
model Chatwoot {
|
||||
@@ -258,6 +267,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