ReferenceInspire
Entities And Relations
Define tables, fields, defaults, primary keys, and foreign-key relations in Inspire.
An entity maps to a database table. It carries both data shape and policy declarations.
Syntax
entity Project {
name: string @minLength(1) @maxLength(120),
ownerId: __User.id,
organizationId: Organization.id?,
archived: boolean = false,
@unique([name, ownerId])
}Notes
- Declare entities with
entity, not@entity. - Fields are required by default. Append
?for nullable. - Foreign keys use
Entity.fieldsyntax. - Defaults are declared inline with
=. - Entity-level annotations handle composite constraints.
Example Relation
entity Organization {
name: string,
}
entity Project {
name: string,
organizationId: Organization.id,
}Related guide: Build Your First App