Make contacts unique for the same instance

Avoid duplicated contacts in the database
This commit is contained in:
Judson Cairo 2024-08-10 23:42:45 -03:00
parent feb7b795e9
commit dacd408f8d
2 changed files with 4 additions and 0 deletions

View File

@ -130,6 +130,8 @@ model Contact {
updatedAt DateTime? @updatedAt @db.Timestamp
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
instanceId String
@@unique([remoteJid, instanceId])
}
model Message {

View File

@ -130,6 +130,8 @@ model Contact {
updatedAt DateTime? @updatedAt @db.Timestamp
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
instanceId String
@@unique([remoteJid, instanceId])
}
model Message {