schema library Declare models

Declares ordinary Dart model classes for static, typed ORM generation.

Annotate public classes with Model, use named field parameters, and run dart run orm generate with a defineConfig project entrypoint. Queries construct the original DTO and preserve its methods; relation loading is explicit. Generation never executes application factories or constructors.

Classes

Check
Declares a class-level database check using trusted SQL.
ClientDefault
Supplies an omitted insert value using a public synchronous factory.
Column
Overrides inferred scalar storage metadata without changing the DTO type.
Computed
Marks a scalar field as database-computed and excludes it from writes. Expressions are trusted SQL using physical column names.
DatabaseDefault
Explicitly declares a database insert default.
Id
Includes a field in the primary key, in constructor declaration order.
Ignore
Excludes an instance field from persistent scalar mapping.
Index
Declares a named index using Dart field names, checked during generation.
Model
Maps an ordinary Dart class to a physical table.
Projection
Declares a named flat SQL projection without a physical table.
Relation
Declares explicit navigation and optionally a physical foreign key.
Unique
Declares a unique field, or a class-level ordered composite unique key.

Enums

ReferentialAction
Database behavior when a referenced row is deleted.