Registry / devops / sequelize-mig-generator

sequelize-mig-generator

JSON →
library0.2.0jsnpmunverified

A command-line tool (v0.2.0) for generating Sequelize migration files automatically by comparing current model definitions with existing schemas. Supports createTable, removeTable, addColumn, modifyColumn, and removeColumn migrations. Currently in active development with a pre-release version (<1.0.0), not recommended for production. Differentiators: contrasts with sequelize-cli's manual migration creation by auto-generating migration code from model changes. Requires Node >=16 and works alongside sequelize-cli.

npm install sequelize-mig-generator
INSTALL
IMPORT
SIG · SEQUELIZE-MIG-GENE
S
sequelize-mig-generator
devopsjavascriptv0.2.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.

sequelize-mig-generator
npx sequelize-mig-generator [options]
import sequelize-mig-generator from 'sequelize-mig-generator'
This is a CLI tool, not a library. Use via npx or local script.
sequelize-mig-generator
npx sequelize-mig-generator -s ./models/init.js
node -e "require('sequelize-mig-generator')"
Tool is run from command line, not imported programmatically.

Shows setup: initialize sequelize-cli, install tool, create script, and run migration generation based on models.

npx sequelize-cli init npm i sequelize-mig-generator --save-dev # In package.json add script: # "make:migrations": "sequelize-mig-generator -s ./models/init.js" # Ensure ./models/init.js exports a function that returns sequelize instance after loading models # Then run: npx sequelize-mig-generator -s ./models/init.js
Debug
Known issues
breakingPre-release version: not for production use.
fix
Wait for stable release or use other tools like sequelize-auto in production.
affects: >=0.0.0 <1.0.0
gotchaRequires a models init script that returns a promise with updated sequelize object. Incorrect path -s causes failure.
fix
Ensure -s points to file that default exports a function returning sequelize instance.
affects: *
gotchaMigration files are generated with .js extension by default. Not compatible with TypeScript projects without configuration.
fix
Use -e .ts flag to specify TypeScript extension, but ensure project supports running TypeScript migrations.
affects: *
deprecatedRelies on .sequelizerc for default paths, which may be deprecated in newer sequelize-cli versions.
fix
Explicitly provide paths via -s and -m options to avoid dependency on sequelize-cli configuration.
affects: *
Errors
Common errors & fixes
Cannot find module 'your-project/node_modules/sequelize-mig-generator/src/cli.js'
Node version mismatch or broken install
fix
Ensure Node >=16 and reinstall with npm i sequelize-mig-generator --save-dev
Error: Models path is not set. Please provide a valid path to the sequelize init file
Missing -s flag or invalid path
fix
Use -s ./path/to/models/init.js pointing to file that exports a function returning sequelize instance
Error: .sequelizerc file not found
Tool tries to read sequelize-cli config for defaults
fix
Create .sequelizerc file or provide all paths explicitly via -s and -m options
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
sequelizerequiredRequired as peer dependency for migration generation against models
sequelize-clirequiredRequired for running migrations and initializing project structure
Agent activity
8 hits · last 30 days
node
6
Bingbot
1
Resources
sequelize-mig-generator — npm install sequelize-mig-generator · libregistry