Rent v0.8.9
Maya's application collects activity timestamps for several posts and flushes them together. Each post needs its own timestamp, and an older event must never overwrite a newer one. Rent v0.8.9 lets generated clients express these updates as one atomic batch.
Different values for each row
Build ordinary keyed updates, then pass them to update_model_many(...).save():
let changed = client.update_user_many([
client.update_user().one(1).name("Maya Chen").name_eq("Collaborator"),
client.update_user().one(2).name("Ken Brooks").name_eq("Collaborator"),
]).save().await?;Each input keeps its own assignments and conditions. Call .one(key) before adding
extra conditions. To identify rows by another declared unique key, use
update_model_many_by(model::unique::key, updates) and supply equality filters for
every key column.
The batch updates existing rows only. It never inserts missing rows. Rent rejects duplicate input keys and rolls back the whole batch if an operation fails, including when a large batch needs several statements. The receiving client supplies the transaction, tenant and permission authority. Selective version rules continue to apply.
Simple PostgreSQL batches with compatible input shapes use one native
UPDATE ... FROM (VALUES ...) per bounded chunk, with bound values rather than a JSON
payload. Eligible joined batches support up to 1,024 inputs per statement, subject to
parameter limits. Other supported shapes can use smaller chunks. Permission checks,
hooks, expected versions and more involved mutations can require per-row execution
inside the same transaction. MySQL and MariaDB use the ordinary per-row executor.
The batch API does not promise one statement for every model or mutation.
Collection relationship edits need ordinary update operations. Invalid batch keys or
unsupported batch inputs return EntityError::InvalidBatchUpdate. See
mutation contracts and the runnable
bulk operations tutorial.
PostgreSQL grant contention
Two transactions granting the same permission can race. A transaction with an older repeatable-read snapshot now receives a retryable serialization conflict instead of an unexpected duplicate-key error during grant insertion. Retry the complete transaction from a fresh snapshot when the error is classified as retryable. Rent does not automatically replay hooks or external side effects. See permission operations.
Upgrade
Use v0.8.9 for the CLI and every Rent crate, regenerate your clients, and commit the
updated application lockfile. The new batch methods do not require a database schema
change. If your application exhaustively matches EntityError, handle the new
InvalidBatchUpdate variant.
Detailed instrumentation remains opt-in. Existing ordinary CRUD calls keep their existing execution paths. Adopt keyed batches where different per-row values would otherwise require multiple update calls, and measure your own workload before replacing specialized raw SQL.
