Define a model
ExtendModel, 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
count, exists, where, whereIn, findOrFail, firstOrFail, store, patch, destroy, and truncate.
Load relationships
Models exposehasOne, 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.