Relation join conditions

Hey - let's say I have the following SQL:

SELECT
    blocks.id,
    blocks.type
FROM
    inspections i
    INNER JOIN inspection_blocks blocks ON i.id = blocks.inspection_id AND blocks.type = 'group';


Is there any way right now to specify the join condition of the relation, e.g?
export const inspectionRelations = relations(({many}) => ({
  groups: many(blocks, {
    where(fields, ops) {
      return ops.eq(fields.type, 'group')
    }
  })
}))
Was this page helpful?