Rent v0.8.2
Rent v0.8.2 adds request-level permission intersections, computed query selections, and PostgreSQL foreign keys that clear selected columns when a parent is deleted.
Request-level permission intersections
For permission-enabled clients, bind an authenticated actor and additional subject
claims to one scoped client with
with_permission_intersection. Reads and writes must satisfy every participant's
permissions. This supports a chain of delegated work while retaining the actual
actor for creator stamping and application policy context.
The API accepts one identified actor and one to fifteen additional claim sets. Each participant retains its own groups, administrator claims and tenant checks. Applications remain responsible for authenticating those claims and validating the delegation chain. Existing actor and two-party delegation APIs retain their behavior.
Computed query selections
Return a calculated value beside stored fields with Computed<T>. For example,
search queries can return a BM25 score and a vector distance alongside each result.
Computed values support aliases, nullable results and native decoding through the
ordinary generated query API. Ordering, limits and root-row authorization remain
part of the query.
Use Computed::trusted for portable results and Computed::trusted_postgres for
PostgreSQL-native results. Declare the actual SQL output type, including
Option<T> for nullable values. SQL type mismatches return decoding errors.
The constructors explicitly trust the selected SQL functions and operators. Root-row permissions do not authorize data a function reads internally. Computed selections reject raw SQL, subqueries, window expressions and references outside the root model. Use the trusted SQL adapter for those query shapes.
PostgreSQL partial foreign-key delete actions
A composite foreign key can preserve its required tenant column while clearing an optional relationship key:
workspace Workspace? @relation(fields: [tenant_id, workspace_id], references: [tenant_id, id], onDelete: SetNull(fields: [workspace_id]))SetDefault(fields: [...]) is supported too. Selected fields must belong to the
local foreign key, and SetNull fields must be nullable. These actions require
PostgreSQL 15 or newer. Other backends reject the subset syntax.
Inspection, migration comparison, foreign-key rebuilds, column renames and
rent db pull retain the selected columns. Existing whole-key actions retain
their behavior when no subset is specified.
Upgrade
Use v0.8.2 for the CLI and every Rent crate. Regenerate configured clients and commit the application's lockfile. Upgrading does not itself change the database. Review the next migration diff, especially when the database already uses a hand-written partial delete action. Opting into a different foreign-key delete action requires a reviewed migration.
For databases already using a hand-written partial delete action, declare the matching subset in RSL before reviewing the next migration diff. Preserve applied migration history and its checksums. Make later changes in a new migration.
Rust code constructing rent_migrate::ForeignKey with a complete struct literal
must add on_delete_columns: None for whole-key actions, or provide the selected
storage columns. Serialized catalogs without this field keep their existing
whole-key behavior. Exhaustive matches on schema or migration-render errors must
handle the new invalid-delete-subset variant.
Existing stored-field tuples and Projection derives continue to work. Computed
selections use tuples and do not require new model declarations.
