Skip to main content
The Archery ORM presents one model API over several storage backends; you will define serializable models, run CRUD operations, and navigate relationships.

Define a model

Extend Model, mix in InstanceDatabaseOps<T>, add a fromJson constructor, and implement toJson() plus toMetaJson(). SQL migrations can use a static column definition map.
lib/src/database/models/role.dart

Query and persist

lib/src/http/routes/roles.dart
Static operations include count, exists, where, whereIn, findOrFail, firstOrFail, store, patch, destroy, and truncate.

Load relationships

Models expose hasOne, hasMany, belongsToOne, and belongsToMany. Use attach() and detach() with a ModelRelationshipType; many-to-many operations also require a PivotTable.
The default disk is DatabaseDisk.file. Pass disk explicitly when a request must use SQLite, Postgres, or S3.