I am trying to fetch data from relation table but prisma shows error: "message": "\nUnknown field posts for include statement on model Channel.",
Planetscale prisma Schema:
id String @id @default(cuid())
title String
posts Post[]
}
model Post {
id String @id @default(cuid())
title String
channelId String @map(name: "channel_id")
channel Channel @relation(fields: [channelId], references: [id])
@@index([channelId])
}
Query with error:
await prisma.channel.findMany({
include: {
posts: true
},
where: {
"id": "example"
},
take: 100
})
how can i resolve this ?