Skip to content

r.relation(...)

r.relation(entity, relationName, definition) — attaches a named relationship to an entity: belongsTo, hasMany, or manyToMany (discriminated by type). Each variant carries the target entity plus its own extras: foreign key or join table, cascade behaviour (onDelete — parent-side only, not on belongsTo), search includes, opt-in nestedWrite expansion. Boot-validation checks that every target resolves to a registered entity (cross-feature targets allowed).


From packages/framework/src/engine/feature-ast/patterns.ts -> RelationPattern