perf: optimisations DB — batch queries et index
- createEvaluation: remplace N create() par un createMany() (N→1 requête) - updateEvaluation: regroupe les upserts en $transaction() parallèle - Ajout d'index sur Evaluation.evaluatorId, Evaluation.templateId, EvaluationShare.userId et AuditLog.evaluationId Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -66,6 +66,9 @@ model Evaluation {
|
||||
isPublic Boolean @default(false) // visible par tous (ex. démo)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([evaluatorId])
|
||||
@@index([templateId])
|
||||
}
|
||||
|
||||
model EvaluationShare {
|
||||
@@ -77,6 +80,7 @@ model EvaluationShare {
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@unique([evaluationId, userId])
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
model DimensionScore {
|
||||
@@ -106,4 +110,6 @@ model AuditLog {
|
||||
newValue String?
|
||||
userId String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([evaluationId])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user