Highlights
Embed migrations in application binaries. The new embed_migrations! macro validates history.toml and its referenced SQL files at compile time, then packages them in the binary. MigrationSet::apply runs only pending migrations through the application Db and reports how many it applied or skipped.
static MIGRATIONS: toasty::migration::MigrationSet =
toasty::embed_migrations!();
MIGRATIONS.apply(&db).await?;Read about embedded migrations.
Cursor pagination now handles ties, compound ordering, and includes. Toasty adds primary-key fields when an order does not uniquely identify every row, expands multi-column cursors lexicographically, honors backend-specific NULL ordering, and preserves cursors when .include() attaches related records. Existing .next() and .prev() calls get stable page boundaries even when ordered values repeat.
let page = Event::all()
.order_by((
Event::fields().created_at().desc(),
Event::fields().priority().asc(),
))
.paginate(50)
.exec(&mut db)
.await?;Network addresses are typed fields. Enable the net feature to use IpCidr, IpInet, MacAddr6, and MacAddr8 in scalar fields, collections, document leaves, and filters. PostgreSQL uses its native CIDR, INET, MACADDR, and MACADDR8 types; MySQL, SQLite, Turso, and DynamoDB use canonical string storage.
Read about supported field types.
Embedded types are more expressive. Newtype embeds now expose ne, gt, ge, lt, le, asc, and desc directly, so callers no longer descend through ._0() to compare or sort by the wrapped value. Multi-field embeds gain ne, and #[belongs_to] fields can appear inside embedded structs and enum variants. Embedded relations currently use explicit key fields and Deferred; eager loading with .include() is not part of this release.
Read about embedded types and the embedded-relation scope.
Backend-agnostic crates compile for WebAssembly. toasty, toasty-core, and toasty-sql now build for wasm32-unknown-unknown. Database driver crates remain native-only.
Upgrade notes
MySQL users must update TLS and URL configuration. v0.10 replaces mysql_async with SQLx and changes the default TLS backend from native TLS to rustls. SQLx ignores the old mysql_async URL options, including require_ssl, verify_ca, and verify_identity; leaving them in place can allow the default ssl-mode=preferred behavior to fall back to plaintext. Replace them with SQLx options:
# v0.9
mysql://app:secret@db.internal/store?require_ssl=true&verify_identity=true
# v0.10
mysql://app:secret@db.internal/store?ssl-mode=verify_identity
To keep native TLS, disable default features and enable mysql plus native-tls. Code that constructs toasty_driver_mysql::Connection directly must now pass sqlx_mysql::MySqlConnection.
Review the v0.10 MySQL configuration.
Custom drivers and low-level API users have source changes. Capability::sql is now Option<Dialect>: capability literals must use Some(Dialect::...) or None, while boolean checks call Capability::sql(). v0.10 also removes unused public helpers from the low-level schema and statement APIs. Applications using generated model and query APIs are not affected by these two changes. See #1155 and #1149.
Changelog
Added
- Re-export external statement value types (#1181)
- (macros) Generate asc/desc on newtype embed fields (#1180)
- Add network address types (#1178)
- Accept #[belongs_to] fields in embedded types (#1170)
- Embed migrations in application binaries (#1095)
Fixed
- Add wasm32 build support (#1173)
- (mysql) [breaking] Make TLS features additive with SQLx (#1147)
- (engine) Omit previous cursor on first page (#1153)
- (engine) Fix IN-subquery statement optimization (#1138)
- (engine) Preserve pagination cursors through includes (#1152)
- Preserve query offset when selecting one row (#1151)
- (engine) Exclude null foreign keys from relation subqueries (#1148)
- (engine) Make cursor pagination deterministic (#1142)
- Resolve authority-form sqlite and turso URLs to a file path (#1127)
- (engine) Fix newtype foreign keys in included relations (#1137)
- Support pagination with multiple order by keys (#1124)