ReferenceInspire
Entities And Relations
Define tables, fields, defaults, primary keys, and foreign-key relations in Inspire.
An entity maps to a database table and 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
- entities are declared with
entity, not@entity - fields are required by default; append
?for nullable fields - foreign keys use
Entity.field - default values are declared inline
- 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