Field Attributes
This reference covers every supported field-level attribute. Model-level (@@) attributes live in their dedicated guides — see
audit log for @@audit,
soft delete for @@soft_delete,
pagination for @@paged, and
auth support matrix for @@allow / @@deny.
Identity & Defaults
Auth-defaulted columns are limited to
String/Cuid, Int, and
Boolean and act as fallbacks: they fill the field only when the
create input omits it. They are not enforcement.
Exposure controls
Use
@readonly for columns the server writes but clients may read (audit
timestamps, computed totals). Use @server_only for columns clients
should never see (internal risk scores, raw token blobs). Use @pii or
@sensitive to control audit redaction without changing input/output
surfaces.
Optimistic locking
See optimistic locking for the full
contract.
The macro excludes
@version from both Create and Update inputs. The
runtime seeds it to 0 on create and bumps it in the same statement as
every update or soft-delete.
Validators
See validators for the full surface, including
the PII-safe error message contract.
Type modifiers
Lists are supported only for a subset of scalars in the current slice;
banks running JSON columns prefer
@db.JsonB on a String for richer
payloads.
Composition
Multiple attributes on one field are space-separated and additive:- exclusion from inputs (
@id,@readonly,@server_only,@version,@default(...)) - validation on whatever survives (
@length,@range,@regex,@email,@uri,@iso4217) - policy evaluation (model-level
@@allow/@@deny) - SQL execution
- response projection (server_only stripped here)
- audit snapshot (pii / sensitive redacted here)