Highlights
Relations are now plain fields, with eager loading by default. The HasMany, HasOne, and BelongsTo wrapper types are gone. A relation field is just its target type, and whether you wrap it in Deferred controls when it loads: a bare field loads eagerly with its parent, a Deferred<...> field loads on demand (via .include() or an accessor).
#[has_many]
posts: Vec<Post>, // eager — loaded with the User
#[has_one]
profile: toasty::Deferred<Option<Profile>>, // on demandMulti-step via relations. Declare relations that traverse an intermediate relation, and load them with .include():
#[has_many(via = posts.comments)]
comments: toasty::Deferred<Vec<Comment>>,update! macro. A new macro for updates, mirroring create!. Set multiple fields in one call, with field shorthand, embedded-struct patches, and has-many inserts:
toasty::update!(user {
name: "Carlos",
email: "carlos@example.com",
})
.exec(&mut db)
.await?;Arithmetic updates. Numeric fields get increment, decrement, add, and subtract, compiled to in-place column updates and usable as method shorthand inside update!:
toasty::update!(comment { views.increment() }).exec(&mut db).await?;Turso driver. libSQL now joins SQLite, PostgreSQL, MySQL, and DynamoDB. On SQLite and Turso, TransactionMode lets you pick the lock-acquisition strategy for concurrent writers.
Raw SQL. An escape hatch for queries the builder doesn't cover, with typed results.
New field wrappers. Deferred<T> (replaces #[deferred]) and toasty::Json<T> (replaces #[serialize(json)]) are ordinary types — they compose with Option, embeds, and derives.
Changelog
toasty
Added
- Derive
Cloneand addDeserializeforDeferred<T>(#994) - [breaking] Increment, decrement, add, and subtract update operators (#979)
update!macro for concise field updates (#980)- Reject
create()on multi-step relation scopes at compile time (#978) - Raw SQL execution API (#965)
- Remove the
#[deferred]attribute in favor ofDeferred<T>(#961) - Eager relation fields (#958)
.include()of multi-stepviarelations (#946)- Expose migration core from
toasty(#944) - Turso driver with TransactionMode-aware concurrent writes (#938)
- Dispatch has-many
stmt::applybatches per entry (#932) TransactionModefor SQLite lock-acquisition control (#931)- Allow
#[version]on tuple-newtype embeds ofu64(#930) - Serialize
SELECT DISTINCT(#934) - [breaking] Replace
#[serialize(json)]with thetoasty::Json<T>wrapper (#926) - Expose the primary-key type via
Model::PrimaryKey(#921) - Fold simple
Batchassignments in update lowering (#917) - Multi-step (
via)has_manyandhas_onerelations (#890) - Non-panicking
try_geton relation types (#918)
Fixed
- Deserialize a present
Deferred<T>value as loaded (#999) - Lift relation-path
LIKEinto a foreign-key subquery (#992) - Lift relation-path
IN-subquery throughBelongsTochains (#990) - Make
starts_withcase-sensitive on SQLite and MySQL (#983) - Handle
ExprOrinevalverify_expr(#959) - [breaking] Scope
.ilike()to PostgreSQL and document operator pass-through (#937)
Other
- [breaking] Merge one-relation field traits (#971)
- Simplify
Fieldbounds now thatLoad<Output = Self>is required (#976) - Move
UpdateTarget::Queryrewrite into lower (#975) - [breaking] Delete the
Relationtrait, tighten relation field shapes (#967) - Split
viarelations into a field variant (#966) - [breaking] Merge has-relation field variants (#964)
- [breaking] Require
Deferredrelation fields (#954) - Gate the SQLite connect doctest (#953)
- Split relation field traits from targets (#950)
- Unify lazy-slot relation encoding (#949)
- [breaking] Move schema diff types to
schema::diff(#929) - Consolidate migration types and reorganize the
db::diffAPI (#928)
toasty-core
Added
- INNER join variant (#922)
Fixed
- Cap SQLite auto-increment integer storage at 4 bytes (#969)
toasty-macros
Added
- [breaking] Remove singular has-many create-builder methods (#977)
Fixed
- Respect the
pairattribute in the#[has_one]macro (#927)
toasty-sql
Other
- Rename types in
toasty_core::schema::diff(#942)
toasty-driver-postgresql
Added
- Adopt
tokio-postgres-rustls0.14 (#952)
Fixed
- Accept libpq query-param connection options (#985)
toasty-driver-dynamodb
Fixed
- Omit empty
ExpressionAttributeValuesonIS NULL/IS NOT NULLscans (#940)
Other crates
toasty-driver-mysql, toasty-driver-sqlite, toasty-driver-turso, toasty-cli, and the integration-suite crates received the shared changes listed above (raw SQL API, Turso driver, required Deferred relation fields, schema-diff move) with no crate-specific entries.