Skip to content

Can Relation() inject custom conditions into LEFT JOIN ON clause?Β #1314

@codevladimir

Description

@codevladimir

I'm using Bun ORM and I have a model with a relation, e.g., Article has one Ad. Bun generates a LEFT JOIN for the relation with soft delete:

LEFT JOIN ads AS ad ON (ad.id = a.ad_id) AND ad.deleted_at IS NULL

I want to add an extra condition (e.g., ad.status = 'active') directly into the JOIN ON clause, not in the WHERE clause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions