-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
First of all, thanks a lot for this extension, which is really crucial in our project as part of a multi-tenant validation.
We ran into an issue related to the usage of the Fluent API of Prisma.
Example schema:
model Parent {
id Int @id @default(autoincrement())
child Child[]
}
model Child {
id Int @id @default(autoincrement())
child String
parent Parent? @relation(fields: [parentId], references: [id])
parentId Int?
}
Example relation query:
const child = await prisma.parent.findUniqueOrThrow({
where: {
id: 1
}
}).child();
Expected output:
[
{
id: 1,
child: 'Test',
parentId: 1,
}
]
Actual output:
[
{
id: 1,
child: null, // <-- Invalid
parentId: 1,
}
]
The problem seems to occur only if a field with the same name as the model is used. The (string) value of the field is then replaced with null
(related to this operation).
We solved it simply by changing the field name of the relation to the plural form (childs
) in order to have a difference to the field name (child
).
Metadata
Metadata
Assignees
Labels
No labels