Registry / database / sequelize-mig

sequelize-mig

JSON →
library3.1.3jsnpmunverified

Sequelize-mig is a CLI tool for auto-generating Sequelize migration files by comparing model schema snapshots. Current stable version 3.1.3 supports commands migration:make (create migration from model changes), migration:undo (revert last migration), and migration:sync (sync schema). Release cadence is irregular; it relies on semantic-release. Key differentiator: automatically detects schema changes (create/drop table, add/remove column, add/remove index, change column) without manual migration writing, unlike sequelize-cli. Note: marked as not for production, under development.

npm install sequelize-mig
INSTALL
IMPORT
SIG · SEQUELIZE-MIG
S
sequelize-mig
databasejavascriptv3.1.3
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 CLI
npx sequelize-mig <command>
const mig = require('sequelize-mig')
sequelize-mig is a CLI tool meant to be run from the command line, not imported programmatically. No package exports.
Installation (global)
npm install -g sequelize-mig
npm install sequelize-mig --save
Global installation recommended for ease of use. Installing as devDependency also works but requires npx.
Usage command
sequelize-mig migration:make -n my_migration
All commands are invoked via CLI; there is no programmatic API. Commands: migration:make, migration:undo, migration:sync.

Shows basic commands: creating a migration with a name, previewing changes, and executing via sequelize-cli.

// npx is used if installed locally; otherwise use global install // Initialize Sequelize project first (using sequelize-cli or manually) // Create initial migration from current models: sequelize-mig migration:make -n init // Preview migration without writing files: sequelize-mig migration:make --preview // Run migration using sequelize-cli: sequelize db:migrate
Debug
Known issues
gotchaTOOL IS UNDER DEVELOPMENT AND NOT INTENDED FOR PRODUCTION USE
fix
Consider using sequelize-cli for production. Verify migration output manually.
affects: >=0.0.1
gotchaCannot detect renameColumn; it creates removeColumn + addColumn instead
fix
Manually edit generated migration to use renameColumn if needed.
affects: >=0.0.1
gotchaThe tool does not track manual edits to migration files or schema; always uses _current.json snapshot
fix
After manual changes, run migration:sync to update _current.json before next migration:make.
affects: >=0.0.1
gotcha_current.json and _current_bak.json are stored in the migrations directory; do not delete manually
fix
Keep these files; they are required for diff calculations.
affects: >=0.0.1
gotchaGenerated migration files are in ES5 format (CommonJS) even if models use ES6
fix
Do not convert migration files to ES6; sequelize-cli expects CommonJS.
affects: >=0.0.1
Errors
Common errors & fixes
sequelize-mig: command not found
Not installed globally or npx not used
fix
Install globally: npm install -g sequelize-mig OR use npx sequelize-mig
Cannot find module 'sequelize'
Sequelize required but not installed in the project directory
fix
Install sequelize in your project: npm install sequelize
Error: ENOENT: no such file or directory, open 'migrations/_current.json'
No initial migration snapshot exists
fix
Run 'sequelize-mig migration:make -n init' to create the first _current.json
Upgrade
Version history
3.1.3latest on npm
Audit
Dependencies
sequelizerequiredRuntime peer dependency; uses Sequelize models for schema detection
sequelize-clioptionalOptional but required to run generated migration files and run db:migrate command
Agent activity
22 hits · last 30 days
node
18
Meta
1
Resources
sequelize-mig — npm install sequelize-mig · libregistry