Registry / database / orange-dragonfly-orm-mysql

orange-dragonfly-orm-mysql

JSON →
library0.8.0jsnpmunverified

MySQL driver for the Orange Dragonfly ORM, a TypeScript ORM for Node.js. Version 0.8.0 provides MySQL-specific configuration: reserved word escaping, fulltext search syntax (MATCH AGAINST), and connection pooling. Requires orange-dragonfly-orm (peer dependency). Actively maintained, supports Node 18+. Alternative to TypeORM or Sequelize with a simpler ActiveRecord pattern.

npm install orange-dragonfly-orm-mysql
INSTALL
IMPORT
SIG · ORANGE-DRAGONFLY-O
O
orange-dragonfly-orm-mysql
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.

MySQLDriver
import MySQLDriver from 'orange-dragonfly-orm-mysql'
Default export. No named export; must be imported as default.
AbstractQuery
import { AbstractQuery } from 'orange-dragonfly-orm'
import { AbstractQuery } from 'orange-dragonfly-orm-mysql'
AbstractQuery is part of the core ORM, not the MySQL driver.
ActiveRecord
import { ActiveRecord } from 'orange-dragonfly-orm'
import ActiveRecord from 'orange-dragonfly-orm'
ActiveRecord is a named export, not default.

Install packages, define models with relations, register MySQL driver, query all brands, and close connection.

npm i orange-dragonfly-orm orange-dragonfly-orm-mysql orange-dragonfly-validator // main.ts import { AbstractQuery, ActiveRecord, Relation } from 'orange-dragonfly-orm' import MySQLDriver from 'orange-dragonfly-orm-mysql' class Brand extends ActiveRecord { static get available_relations() { return { models: Relation.children(this, this.model('CarModel')), } } } class CarModel extends ActiveRecord {} AbstractQuery.registerDB(new MySQLDriver({ host: process.env.MYSQL_HOST ?? 'localhost', port: parseInt(process.env.MYSQL_PORT ?? '3306', 10), user: process.env.MYSQL_USER ?? 'root', password: process.env.MYSQL_PASSWORD ?? '', database: process.env.MYSQL_DB ?? 'mydb', })) ActiveRecord.registerModel(Brand) ActiveRecord.registerModel(CarModel) const brands = await Brand.all() console.log(brands) await AbstractQuery.releaseDB()
Debug
Known issues
breakingMySQLDriver configuration is not validated on construction; invalid options silently default
fix
Manually validate config before passing to MySQLDriver, e.g. using orange-dragonfly-validator.
affects: >=0.8.0
deprecatedconnect() and disconnect() methods may be removed in future versions; use AbstractQuery.releaseDB() instead
fix
Call AbstractQuery.releaseDB() to close connections instead of driver.disconnect().
affects: >=0.8.0
gotchaPeer dependency orange-dragonfly-orm must be installed separately; install command shown may miss it
fix
Run: npm i orange-dragonfly-orm orange-dragonfly-orm-mysql orange-dragonfly-validator
affects: >=0.8.0
gotchaThe driver modifies global ORMHelpers (ESCAPE_CHAR, RESERVED_WORDS, FULL_TEXT_CLAUSE_FN). Switching drivers without disconnect may cause conflicts
fix
Always call AbstractQuery.releaseDB() before registering a different driver.
affects: >=0.8.0
Errors
Common errors & fixes
Error: Cannot find module 'orange-dragonfly-orm'
Missing core peer dependency
fix
npm install orange-dragonfly-orm
Error: registerDB expects an instance of AbstractDriver
Importing MySQLDriver incorrectly
fix
Use default import: import MySQLDriver from 'orange-dragonfly-orm-mysql'
TypeError: driver.connect is not a function
Calling .connect() on MySQLDriver instance; the driver's connect is managed internally
fix
Do not call .connect() manually. Connection happens on first query via AbstractQuery
ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server
MySQL 8+ default authentication plugin (caching_sha2_password) may not be supported by the underlying mysql2 driver
fix
ALTER USER 'user'@'host' IDENTIFIED WITH mysql_native_password BY 'password'; or use a compatible authentication plugin
Upgrade
Version history
0.8.0latest on npm
Audit
Dependencies
orange-dragonfly-ormrequiredCore ORM package required; provides base classes like ActiveRecord, AbstractQuery, Relation
orange-dragonfly-validatoroptionalPeer dependency for validation (optional but installed automatically with npm 7+)
Agent activity
2 hits · last 30 days
node
2
Resources
orange-dragonfly-orm-mysql — npm install orange-dragonfly-orm-mysql · libregistry