Registry / database / cbt-sequelize-auto

cbt-sequelize-auto

JSON →
library0.8.7jsnpmunverified

Sequelize-Auto (v0.8.7) automatically generates bare Sequelize models from an existing database. Supports MySQL, MariaDB, PostgreSQL, SQLite, and MSSQL with their respective dialect packages. It runs via CLI, reads database schemas, and outputs model files (JavaScript or TypeScript with bundled types). Last release stable but low activity; no longer installs sequelize as a dependency, requiring users to manually add both sequelize and dialect packages. Key features: customizable case conventions for models, properties, and filenames; support for excluding/including specific tables; additional model options via JSON config files.

npm install cbt-sequelize-auto
INSTALL
IMPORT
SIG · CBT-SEQUELIZE-AUTO
C
cbt-sequelize-auto
databasejavascriptv0.8.7
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default (CLI command)
npx sequelize-auto -h <host> -d <database> -u <user> -x <password> --dialect <dialect> -o ./models
sequelize-auto -h <host> ...
Use npx to run without global install, or install globally with npm i -g sequelize-auto.
Models (generated output)
const { User } = require('./models');
import User from './models/User';
Generated models use CommonJS exports by default. If TypeScript output is enabled (via --ts), switch to ES import syntax.
Tables option
sequelize-auto -t "users orders"
sequelize-auto -t users orders
Tables must be space-separated within a single argument string when using -t. Each table name is a separate value in the array.

Generates Sequelize models for the 'users' table from a MySQL database into ./models folder.

npx sequelize-auto -h localhost -d my_db -u root -x mypassword --dialect mysql -o ./models -t users
sequelize-auto --version
Debug
Known issues
breakingsequelize-auto no longer installs sequelize as a dependency since version 0.7.0. You must manually install sequelize and the appropriate dialect package.
fix
npm install sequelize mysql2 (or your dialect) before running sequelize-auto.
affects: >=0.7.0
deprecatedThe --tables (-t) and --skipTables (-T) options expect table names to be provided as space-separated arguments within a single string, but passing multiple --t values is also accepted. The single-arg style is the documented and recommended approach.
fix
Use -t "table1 table2" instead of -t table1 -t table2.
affects: >=0.6.0
gotchaWhen using --additional (-a) to provide model options, the JSON file path must be relative to the current working directory. Absolute paths also work, but relative paths are error-prone.
fix
Ensure the path is correct: --additional ./config/options.json
affects: >=0.5.0
gotchaGenerated models use Sequelize v5+ syntax (sequelize.define) but may not be fully compatible with Sequelize v6 if using legacy options. Always check your Sequelize version.
fix
Update models manually or use a newer version of sequelize-auto that targets Sequelize v6.
affects: >=0.5.0
Errors
Common errors & fixes
Error: Cannot find module 'sequelize'
sequelize-auto requires sequelize to be installed as a peer dependency, but it's not present.
fix
npm install sequelize
Error: No dialect binding found for 'mysql'
The required dialect package (e.g., mysql2) is not installed.
fix
npm install mysql2 (or your dialect: pg, sqlite3, tedious)
Error: getaddrinfo ENOTFOUND localhost
The hostname provided via -h is unreachable or incorrect.
fix
Verify your database host address and ensure it's accessible.
SyntaxError: Unexpected token '.' in JSON at position 0
The --config or --additional option points to an invalid or empty JSON file.
fix
Check that the JSON file exists and is correctly formatted.
Upgrade
Version history
0.8.7latest on npm
Audit
Dependencies
sequelizerequiredPeer dependency; sequelize-auto generates models for Sequelize and requires it to be installed separately.
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
cbt-sequelize-auto — npm install cbt-sequelize-auto · libregistry