There is a bug when 1 to 1 relation is used in Prisma schema.
Example schema file:
model Post {
id String @id @default(cuid())
postDetail PostDetail?
}
model PostDetail {
id String @id @default(cuid())
postId String
post Post @relation(fields: [postId], references: [id]) @unique
}
Example output:
builder.prismaObject('Post', {
fields: (t) => ({
id: t.exposeID('id'),
postDetail: t.relation('postDetail', { nullable: false }) // Only `nullable: true` should be allowed!!
})
})
is allowed but nullable: false should not allowed here because the prisma client could return null for the relation postDetail.
There is a bug when 1 to 1 relation is used in Prisma schema.
Example schema file:
Example output:
is allowed but
nullable: false
should not allowed here because the prisma client could return null for the relationpostDetail
.