Registry / database / egg-mysql-sequelize-auto

egg-mysql-sequelize-auto

JSON →
library1.1.0jsnpmunverified

A CLI tool that automatically generates Sequelize model files for Egg.js from a MySQL database. Version 1.1.0, low release cadence (last update 2020). Key differentiator: generates TypeScript models with type definitions, specifically for Egg.js framework. Alternative to sequelize-auto with Egg.js integration and opinionated output structure. Produces both model and definition files under app/model/ and app/model/define/. Supports table selection, overwrite, and configurable output directory.

databasedevops
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.

Sequelize v6+ requires named import

import { Sequelize } from 'sequelize'

Egg.js exports Application type

import { Application } from 'egg'

CreationAttributes is needed for strict typing since v6

import { Model, CreationAttributes } from 'sequelize'

Shows installation, configuration via npm script, and CLI execution to generate Egg.js Sequelize models from a MySQL database.

// 1. Install globally or as devDependency npm i -D egg-mysql-sequelize-auto // 2. Create script in package.json: "scripts": { "model": "mysql-sequelize-auto -h localhost -d mydb -p 3306 -u root -x 'password' -o './app/model' -t users" } // 3. Run: npm run model // 4. Generated files: // app/model/users.ts (model) // app/model/define/users.d.ts (type definitions)
Debug
Known footguns
breakingTable name must be provided with -t option; without it, no models are generated.
deprecatedCLI uses mysql2 driver; older MySQL versions might not be supported.
gotchaOutput directory './app/model' is relative to project root, not where command is run.
gotchaGenerated models reference app.Sequelize, which must be configured via egg-sequelize plugin.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
6 hits · last 30 days
gptbot
3
Resources