Add where clause on 1-1 relation (Query mode)
I want to include relation 1-1 with where clause such as ‘isNull(table.deletedAt)’
Now i use alternative way define relations with one-many that allow me to add where clause on query mode.
and get data from first element of array
Example
db.query.products.findfirst({
with: {
images: {
where: isNull(images.deletedAt)
}
}
})
But It’s not allow me when 1-1 relation
Thank you so much
1 Reply
👋
where
is only available in with many
because with one
it is expected to only have one result.
If you want you can share an example of what you are trying to achieve with https://drizzle.runDrizzle Run
Drizzle Run