Skip to content

(feat): add Schema\Order for index column directions - #21

Merged
abnegate merged 1 commit into
mainfrom
feat-schema-order
Aug 21, 2026
Merged

(feat): add Schema\Order for index column directions#21
abnegate merged 1 commit into
mainfrom
feat-schema-order

Conversation

@abnegate

Copy link
Copy Markdown
Member

Why

Index definitions already use IndexType. Column direction was still 'ASC' / 'DESC' (or Database::ORDER_* at call sites). That is the same class of magic string IndexType removed.

OrderDirection stays on the query AST because it includes RANDOM, which is not a valid index column order.

What

  • Utopia\Query\Schema\Order with Asc / Desc
  • Schema index DDL validates orders through Order::tryFrom()

Not verified

  • Downstream call sites in database / migration / Appwrite (follow-up on those PRs)

Index types already use IndexType; column order was still a raw ASC/DESC
string. Schema\Order is the matching enum so call sites do not keep
magic strings next to typed index types.
@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a schema-specific Order enum for index column directions while preserving the existing validation behavior.

  • Defines Order::Asc and Order::Desc.
  • Uses Order::tryFrom() when validating SQL index column directions.
  • Adds unit coverage for the enum values.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

The new enum is compatible with the package’s supported runtime and preserves the existing case-insensitive ASC/DESC validation semantics for all reachable string inputs.

Important Files Changed

Filename Overview
src/Query/Schema.php Replaces explicit ASC/DESC comparisons with equivalent validation through the new schema enum.
src/Query/Schema/Order.php Introduces a backed enum containing the two valid index column directions.
tests/Query/Schema/OrderTest.php Verifies that the enum cases retain the expected uppercase SQL values.

Reviews (1): Last reviewed commit: "(feat): add Schema\Order for index colum..." | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown

📊 Coverage

Metric PR Baseline Δ
Lines 91.88% (7559/8227) 91.88% +0.00%
Methods 83.89% (1114/1328) 83.89% +0.00%
Classes 65.16% (144/221) 65.45% -0.30%

Full per-file breakdown in the job summary.

@abnegate
abnegate merged commit abaebb2 into main Aug 21, 2026
7 checks passed
@abnegate
abnegate deleted the feat-schema-order branch August 21, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant