Relation join conditions
Hey - let's say I have the following SQL:
Is there any way right now to specify the join condition of the relation, e.g?
Is there any way right now to specify the join condition of the relation, e.g?
SELECT
blocks.id,
blocks.type
FROM
inspections i
INNER JOIN inspection_blocks blocks ON i.id = blocks.inspection_id AND blocks.type = 'group';export const inspectionRelations = relations(({many}) => ({
groups: many(blocks, {
where(fields, ops) {
return ops.eq(fields.type, 'group')
}
})
}))