Registry / database / grind-orm

grind-orm

JSON →
library0.8.0jsnpmunverified

Grind ORM is an ORM provider for the Grind framework, integrating Objection.js to provide full ES6/7 class-based Models and helpers. Current stable version is 0.8.0, with beta peer dependencies on grind-db and grind-framework. It follows the main Grind release cadence and differentiates by tightly coupling with Grind's architecture, offering familiar patterns for Grind users.

npm install grind-orm
INSTALL
IMPORT
SIG · GRIND-ORM
G
grind-orm
databasejavascriptv0.8.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Model
import { Model } from 'grind-orm'
const Model = require('grind-orm').Model
ESM default; CommonJS require also works but is not recommended for new code.
GrindORMProvider
import { GrindORMProvider } from 'grind-orm'
import GrindORMProvider from 'grind-orm'
Named export, not default. The provider class is named export.
Objection
import { Objection } from 'grind-orm'
const Objection = require('grind-orm').Objection
Provides access to the underlying Objection.js instance for advanced use.

Shows how to import and use Grind ORM with a simple Model class and register providers.

import { GrindORMProvider, Model } from 'grind-orm'; import { App } from 'grind-framework'; import { GrindDbProvider } from 'grind-db'; const app = new App(); app.register(GrindDbProvider); app.register(GrindORMProvider); class User extends Model { static tableName = 'users'; static jsonSchema = { type: 'object', required: ['name', 'email'], properties: { id: { type: 'integer' }, name: { type: 'string', minLength: 1, maxLength: 255 }, email: { type: 'string' }, }, }; } export default User;
Debug
Known issues
breakingPeer dependencies must be version-compatible; grind-db and grind-framework must match the same major version range as grind-orm.
fix
Ensure all three packages are version 0.8.x.
affects: >=0.8.0
deprecatedThe package is in early beta; API may change without notice.
fix
Pin exact versions and monitor releases.
affects: <1.0.0
gotchaModel must have a static tableName property; otherwise Objection throws an error.
fix
Always define static tableName in Model subclasses.
affects: *
gotchaUsing Model without registering GrindDbProvider will cause runtime errors.
fix
Register GrindDbProvider before GrindORMProvider.
affects: *
breakingIn version 0.7.x, the import path was different; upgrade to 0.8.x requires changing imports from 'grind-orm/lib/...' to 'grind-orm'.
fix
Update import statements to use the main package entry.
affects: <0.8.0
Errors
Common errors & fixes
Cannot find module 'grind-db'
Missing peer dependency grind-db.
fix
Run npm install grind-db@^0.8.0-beta.1
Model .query() is not a function
GrindDbProvider not registered or database connection not configured.
fix
Register GrindDbProvider and ensure db config exists.
TypeError: Class extends value undefined is not a constructor or null
Importing Model incorrectly (e.g., default import instead of named).
fix
Use import { Model } from 'grind-orm' (named import).
Unknown model property: tableName
Defining tableName as instance property instead of static.
fix
Add static keyword: static tableName = 'users';
Upgrade
Version history
0.8.0latest on npm
Audit
Dependencies
grind-dbrequiredPeer dependency required for database connectivity
grind-frameworkrequiredPeer dependency required for framework integration
Agent activity
9 hits · last 30 days
node
8
Resources
grind-orm — npm install grind-orm · libregistry