You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(orm): cast fields with @db.* native type annotations to base SQL type
When a field has a native database type annotation like @db.Uuid,
PostgreSQL stores it as that native type. Comparing such a field with
a plain String field (e.g., in policy expressions like `id == x`) causes
a type mismatch error. This fix casts fields with @db.* attributes back
to their ZModel base SQL type in fieldRef(), which affects both SELECT
and WHERE clauses.
- Add abstract `getSqlType()` to BaseCrudDialect with implementations
in PostgreSQL, SQLite, and MySQL dialects
- Add `hasNativeTypeAttribute()` helper to detect @db.* attributes
- Modify `fieldRef()` to apply CAST for fields with native type annotations
- Update policy expression transformer to use dialect's fieldRef()
Fixes#2394
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0 commit comments