feat(orm): where_column / or_where_column column comparison with operators#168
Open
tmgbedu wants to merge 1 commit into
Open
feat(orm): where_column / or_where_column column comparison with operators#168tmgbedu wants to merge 1 commit into
tmgbedu wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Author
✅ Approve — full Laravel subquery parity, verified independentlyReviewed the complete diff, traced the surrounding grammar/builder code, ran the gates, and probed the critical paths adversarially. This is clean, well-tested work. Verified
Minor, non-blocking (optional follow-ups)
Neither blocks merge. Approving. |
Extend where_column() with an optional 3-arg operator form and add the OR-joined or_where_column() companion: - where_column(a, b) -> a = b (2-arg equality, unchanged) - where_column(a, op, b) -> a op b (op in =, !=, <>, >, >=, <, <=) - or_where_column(...) -> same forms, joined with OR Both column identifiers stay identifiers (never bound values); an invalid operator raises ValueError. Grammar value_equal_string() now renders the operator across all four dialects (SQLite, MySQL, Postgres, MSSQL). Covered by grammar-level SQL assertions for both arities and the OR combinations across all four grammars, plus a real sqlite-backed suite.
b48a02c to
b84c971
Compare
This was referenced Jul 12, 2026
Contributor
Author
✅ Approve (reshaped scope) —
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scope reduced (per review of the original bundled PR): this PR now contains only the foundational column-comparison primitive.
order_by(builder)andselect_sub/add_select/table()have been split into their own follow-up PRs so each reviews independently.Extends
where_column()with an optional operator form and adds the OR-joined companionor_where_column():Behavior
=; 3 args →(col1, operator, col2).=, !=, <>, >, >=, <, <=; anything else raisesValueError.value_equal_string()renders the operator across all four dialects (SQLite, MySQL, Postgres, MSSQL).Tests
tests/masoniteorm/query/grammars/test_where_column_grammar.py— grammar-level SQL assertions for both arities, every operator, and the OR combinations, across all 4 dialects; plus invalid-operator rejection and a binding check (only the literal is bound).tests/masoniteorm/sqlite/builder/test_sqlite_where_column.py— real sqlite-backed filtering for=,>,<,!=, and OR-combined conditions.Gates
uv run pytest --ignore=tests/masoniteorm/postgres --cov→ 1814 passed / 7 skipped, coverage 78.81% (≥ fail_under 68).ruff check+ruff format --checkclean.Related (follow-ups, review independently)
order_by(builder)correlated-subquery ordering.select_sub/add_select/table()subquery-as-column.Recommended merge order: this PR first (foundational primitive), then A and B.