Relation Mode Prisma Indexes
I'm getting this warning in my schema on the okr and parentTask lines any idea how to solve this?
With `relationMode = "prisma"`, no foreign keys are used, so relation fields will not benefit from the index usually created by the relational database under the hood. This can lead to poor performance when querying these fields. We recommend adding an index manually. Learn more at https://pris.ly/d/relation-mode-prisma-indexes"
With `relationMode = "prisma"`, no foreign keys are used, so relation fields will not benefit from the index usually created by the relational database under the hood. This can lead to poor performance when querying these fields. We recommend adding an index manually. Learn more at https://pris.ly/d/relation-mode-prisma-indexes"
model Task {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String @db.VarChar(255)
content String @default("No Content") @db.Text
status String @default("TODO") @db.VarChar(255)
authorId String @db.VarChar(255)
spaceId String @db.VarChar(255)
dueDate DateTime
assignees User[] @relation("assignee")
space Space? @relation(fields: [spaceId], references: [id])
parentId String?
parentTask Task? @relation("subTask", fields: [parentId], references: [id], onUpdate: NoAction, onDelete: NoAction)
childTasks Task[] @relation("subTask")
okr okr? @relation(fields: [okrId], references: [id])
okrId String?
@@index([spaceId, parentId, okrId])}
model Task {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String @db.VarChar(255)
content String @default("No Content") @db.Text
status String @default("TODO") @db.VarChar(255)
authorId String @db.VarChar(255)
spaceId String @db.VarChar(255)
dueDate DateTime
assignees User[] @relation("assignee")
space Space? @relation(fields: [spaceId], references: [id])
parentId String?
parentTask Task? @relation("subTask", fields: [parentId], references: [id], onUpdate: NoAction, onDelete: NoAction)
childTasks Task[] @relation("subTask")
okr okr? @relation(fields: [okrId], references: [id])
okrId String?
@@index([spaceId, parentId, okrId])}
2 Replies