Known Limitations (v0.1.0)
Verified against source. Grouped by how likely you are to hit them.
You’ll hit these on day one
Comparison operators only exist for String and Int
eq, not_eq, gt, gte, lt, lte are implemented only for
Field<E, String> and Field<E, i32>.
Not available on: Boolean, Float, DateTime, Decimal, Json, and
every nullable field (Option<T>).
rust Post::published.eq(true) // ✗ won't compile User::created_at.gt(cutoff) // ✗ User::bio.eq("x") // ✗ nullable User::bio.is_null() // ✓ null checks work on any type
Workaround: raw SQL for that query. See Query Builder.
Update structs have no Default
..Default::default() won’t compile. List every field, None to skip.
Over JSON this is a non-issue — serde fills absent fields.
Literal defaults are still required in Create
@default(0) / @default(false) do not make a field optional. Only
autoincrement() and now() are excluded.
Loaded many-to-one relations don’t serialize
Back-references carry #[serde(skip)] to prevent recursion. A loaded
Post.user is invisible in raw model JSON. Use DTOs.
sqlx must be 0.8
Zyvor 0.1 depends on sqlx 0.8. Using 0.9 puts two sqlx_core versions in your
graph and produces FromRow / Acquire trait-bound errors.
Query builder
| Limitation | Detail |
|---|---|
Single ORDER BY column | second order_by() replaces the first |
HAVING can’t compare aggregates | .count() returns SelectItem, which has no .gt() |
count() ignores GROUP BY / HAVING / LIMIT / OFFSET | counts joins + WHERE only |
count() / fetch_all() are pool-only | take &PgPool, not impl Acquire — no transactions |
| Unqualified GROUP BY / ORDER BY | can be ambiguous when joining tables with shared column names |
No first() / one() / like() | use all() + .into_iter().next(), or raw SQL |
| No CTE, UNION, FOR UPDATE | — |
Relations
| Limitation | Detail |
|---|---|
with_nested needs a collection relation | requires RelationLoader (Vec). .with_nested(Post::user, ..) won’t compile |
| Unloaded vs empty is ambiguous | [] / None means both. Only trust it after .with() |
| Composite foreign keys | parsed, but codegen handles single-column only |
| Pivot tables | must be declared as an explicit model |
Schema
| Limitation | Detail |
|---|---|
Primary key must be Int | update/delete take id: i32 concretely |
Composite @@id | unsupported — surrogate id + @@unique([...]) |
Scalar arrays (String[]) | parsed, rejected by CRUD generation |
@updatedAt | parsed, no behaviour generated |
@default(cuid()) | parsed, no SQL default |
| Block comments | not supported |
| Validator gaps | cardinality/array-shape consistency, default-value type compatibility, full @@index/@@unique field validation |
| Error locations | no line/column in messages yet |
Types
DateTime→TIMESTAMP, notTIMESTAMPTZ. No timezone stored.Int→i32(noti64).
Errors
A typed Error enum exists and auto-classifies PostgreSQL 23505 / 23503 /
RowNotFound. Matching on variants works.
Rough edges in 0.1:
| Issue | Detail |
|---|---|
| Memory leak | From<sqlx::Error> uses Box::leak for &'static str fields. Every classified constraint violation leaks two allocations permanently |
| Placeholder fields | NotFound.entity = "unknown", NotFound.id = -1, ForeignKeyViolation.referenced_entity = "unknown" |
| Fragile parsing | entity/field derived from constraint-name splitting; breaks on multi-word tables (user_profiles_user_id_key → field id) |
UniqueViolation.value | holds the full PG message, not the duplicate value |
| Two error types | CRUD → zyvor::Error; queries → sqlx::Error. Bridge with .map_err(zyvor::Error::from) |
| Two migration error systems | runtime MigrationError enum vs CLI’s formatted-string errors |
Generation misuse | runtime input validation reported as a codegen error variant |
Guidance: match on variants for status codes; write your own user-facing
messages rather than trusting entity / field.
Migrations
| Missing | Workaround |
|---|---|
ALTER COLUMN TYPE | hand-write a forward migration |
| rename detection | ⚠️ a rename becomes DROP + ADD — data loss. Review every diff |
| index / constraint diffs | hand-write |
rollback, migrate status, migrate reset | forward migration |
| auto pivot tables | declare the pivot model |
Database support
PostgreSQL only. SQLite and MySQL are not implemented.
Planned
0.1.1 — additive, non-breaking
Defaultderive onUpdatestructscount/fetch_allgeneric overAcquire(transaction support)- Multi-column
order_by migrate status- Populate
NotFound/referenced_entityproperly; usedb_err.table()/.column()instead of constraint-name parsing
0.2.0 — breaking
- Comparison operators for
bool,f64,DateTime,Decimal,Option<T> - Error enum fields
&'static str→String(removes theBox::leakleak) - Unified error type across queries and CRUD
Primary key must be an Int column literally named id
update and delete emit WHERE id = $1. Both the type (i32) and the column
name (id) are hardcoded. @mapping your PK to another name breaks these two
methods; update_many / delete_many still work.
Identifiers are unquoted in the executor
Migrations quote identifiers; the executor does not. Use lowercase snake_case
table and column names. @@map("User") or any name needing quoting will fail at
runtime.
Empty update is an error
All-None update → Err(Error::Generation(..)), not a no-op. Guard PATCH
endpoints.
Models with only auto-generated fields
If every column is @default(autoincrement()) or @default(now()), the
generated Create struct has no fields and the INSERT has an empty column list.
Keep at least one user-supplied column per model.