-
-
Couldn't load subscription status.
- Fork 126
Closed
Labels
Milestone
Description
Having the following models:
model House {
id Int @id @default(autoincrement())
doorTypeId Int
door Door @relation(fields: [doorTypeId], references: [id])
type String
@@delegate(type)
}
model PrivateHouse extends House {
card Int
}
model Skyscraper extends House {
ticket Int
}
model Door {
id Int @id @default(autoincrement())
color String
houses House[]
type String
@@delegate(type)
}
model IronDoor extends Door {
strength Int
}
model WoodenDoor extends Door {
texture String
}
if I do the following query:
const query = await db.privateHouse.findUnique({
where: { id: 1 },
include: {
door: true
}
})
The output will be:
query {
id: 1,
doorTypeId: 1,
type: 'PrivateHouse',
door: { id: 1, color: 'red', type: 'IronDoor' },
card: 2
}
as you can see it does not include the irondoor attributes, i would suggest to include it, or at least change the syntax of findunique to be the following to include it:
const query = await db.privateHouse.findUnique({
where: { id: 1 },
include: {
door: {
include: { ironDoor: true }
}
}
})
Versions:
"devDependencies": {
"prisma": "^5.19.1",
"typescript": "^5.6.2",
"zenstack": "2.5.1"
},
"dependencies": {
"@prisma/client": "^5.19.1",
"@zenstackhq/runtime": "2.5.1"
}