feat: improve workspace index

This commit is contained in:
DarkSky
2026-01-01 01:39:40 +08:00
parent c7b74384a4
commit 91e6f3c45c
4 changed files with 259 additions and 98 deletions
+4
View File
@@ -135,6 +135,7 @@ model Workspace {
commentAttachments CommentAttachment[]
@@index([lastCheckEmbeddings])
@@index([createdAt])
@@map("workspaces")
}
@@ -159,6 +160,7 @@ model WorkspaceDoc {
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
@@id([workspaceId, docId])
@@index([workspaceId, public])
@@map("workspace_pages")
}
@@ -206,6 +208,7 @@ model WorkspaceUserRole {
@@unique([workspaceId, userId])
// optimize for querying user's workspace permissions
@@index([workspaceId, type, status])
@@index(userId)
@@map("workspace_user_permissions")
}
@@ -832,6 +835,7 @@ model Blob {
AiWorkspaceBlobEmbedding AiWorkspaceBlobEmbedding[]
@@id([workspaceId, key])
@@index([workspaceId, status, deletedAt])
@@map("blobs")
}