Skip to content
What's new

Rent v0.7.1

This release improves PostgreSQL migrations and lets relationships use names that Rust reserves. It also brings smaller generated clients, SQL inspection for grouped queries, and fewer repeated reference reads in eligible batched writes.

Keep your schema readable

PostgreSQL often adds casts or parentheses when it stores an expression. Rent recognizes equivalent spellings for typed numeric checks, native-enum literals, JSON mode checks and text patterns. Floating-point and native-enum defaults also stay stable after applying a migration.

Real changes to a constraint, predicate or default still produce a migration. Keep applied history intact. See migrations.

Use familiar relationship names

A relationship named type now has a valid Rust accessor, row.r#type()?. Loading and traversal keep the familiar with_type(...) and query_type() names. RSL and JSON retain the original relationship name. See relationships.

Inspect grouped queries

Call to_sql() on a grouped query to inspect the same statement its execution method will run. This makes it easier to review aggregation plans without maintaining a second SQL statement by hand. See production database access.

Keep generated changes focused

Generated Rust files have stable headers. Schema and generator provenance live in one metadata file, so changing one part of a schema does not rewrite every source header. Shared query, relationship and cursor helpers also reduce repeated code.

Eligible batched creates reuse equivalent reference checks within their transaction. PostgreSQL can read distinct reference keys together while retaining the locks and permission checks that protect the write. Reference validation uses shared locks so independent child writes can overlap. If a command also changes the referenced row, lock that row for update before creating its children. See transactions.

Upgrade

Upgrade every Rent crate and the CLI together, regenerate configured clients, and commit the application's lockfile. Existing Rust files keep their stable headers. The generation metadata records the new version.

Transaction retry callbacks now receive an owned transaction handle. Write the callback as |tx| async move { ... }, and borrow &tx inside it when a helper expects a reference. Keep external side effects outside retry callbacks. See transaction retries.