Registry / database / webiny-entity-mysql

webiny-entity-mysql

JSON →
library1.9.0jsnpmunverified

MySQL driver for the Webiny entity layer, version 1.9.0. Provides MySQL persistence for Webiny's entity abstraction. Requires peer dependency serverless-mysql ^1.1.0. Lightweight driver that wraps mysql connection/pool and integrates with webiny-entity. Unmaintained since 2021 with no active development.

npm install webiny-entity-mysql
INSTALL
IMPORT
SIG · WEBINY-ENTITY-MYSQ
W
webiny-entity-mysql
databasejavascriptv1.9.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 'webiny-entity-mysql'
const MySQLDriver = require('webiny-entity-mysql')
Package exports a single named export MySQLDriver as a class.

Configures MySQLDriver with mysql connection and sets it as the driver for a base entity class.

import { MySQLDriver } from 'webiny-entity-mysql'; import { Entity as BaseEntity } from 'webiny-entity'; import mysql from 'mysql'; const connection = mysql.createConnection({ host: 'localhost', user: 'root', password: process.env.DB_PASSWORD ?? '', database: 'webiny', timezone: 'Z' }); class Entity extends BaseEntity {} Entity.driver = new MySQLDriver({ connection }); class User extends Entity { constructor() { super(); this.attr('firstName').char(); this.attr('lastName').char(); } } export default Entity;
Debug
Known issues
deprecatedPackage is no longer maintained; last release in 2021.
fix
Migrate to an alternative ORM or database driver.
affects: >=1.0.0
gotchaRequires peer dependency serverless-mysql ^1.1.0 which may not be compatible with all mysql versions.
fix
Ensure serverless-mysql is installed and version matches.
affects: >=1.0.0
gotchaThe driver expects a mysql connection object; not compatible with promise-based mysql2 directly.
fix
Use mysql package or adapt mysql2 with a wrapper.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'serverless-mysql'
Missing peer dependency serverless-mysql
fix
Run: yarn add serverless-mysql@^1.1.0
TypeError: Entity.driver.setConnection is not a function
Driver not properly initialized or wrong class used
fix
Ensure MySQLDriver is instantiated with a valid connection object and assigned to Entity.driver
Upgrade
Version history
1.9.0latest on npm
Audit
Dependencies
serverless-mysqlrequiredPeer dependency required for query execution
Agent activity
29 hits · last 30 days
node
24
Meta
1
OpenAI (training)
1
Resources
webiny-entity-mysql — npm install webiny-entity-mysql · libregistry