How can query relationships in Prisma? I have the following schema:
model User {
id Int @id @default(autoincrement())
name String?
profile Profile
}
model Profile {
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId Int
}
How can I query a Profile
for a specific User
?
Found the answer myself:
prisma.user.findUnique({ where: { id: 42 }}).profile()