Error validating model "Comment": Ambiguous self relation detected. The fields
comment
andComment
in modelComment
both refer toComment
. If they are part of the same relation add the same relation name for them with@relation(<name>)
.
model Comment {
id Int @id @default(autoincrement())
text String @db.VarChar
rating Int @default(0)
createdAt DateTime @default(now()) @db.Timestamp(6)
creatorId Int
postId Int?
repliedToId Int?
user User @relation(fields: [creatorId], references: [id])
post Post? @relation(fields: [postId], references: [id])
comment Comment? @relation(fields: [repliedToId], references: [id])
Comment Comment[] @relation("CommentToComment")
CommentRating CommentRating[]
}