Registry / database / easy-migrate

easy-migrate

JSON →
library1.1.6jsnpmunverified

easy-migrate is a migration framework for Node.js that automatically generates up and down migration scripts by comparing Sequelize model configuration files with the current database schema. Version 1.1.6 (latest) supports MySQL only, with limited data types (INT, VARCHAR, DECIMAL, DATETIME, DATE, TEXT, LONGTEXT). It provides a CLI tool (migrate) with create, up, down, and config commands. Unlike general migration tools, it automates migration content generation based on model definition changes, reducing manual SQL writing. The project appears to be in maintenance mode with no recent updates and limited community activity.

npm install easy-migrate
INSTALL
IMPORT
SIG · EASY-MIGRATE
E
easy-migrate
databasejavascriptv1.1.6
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.

migrate (CLI)
npm install -g easy-migrate && migrate create ...
import ... from 'easy-migrate'
easy-migrate is primarily a CLI tool and should be installed globally. There is no programmatic API exposed.
configuration (db config)
module.exports = { database: 'test', username: 'root', password: '', host: 'localhost', dialect: 'mysql' };
using unsupported dialect like 'postgres'
The db config file must export a Sequelize-compatible configuration object. Only MySQL is supported.
migration files (output)
Generated file exports { up, down } functions as shown in README.
Manual modification of generated files is error-prone; they are meant to be auto-generated.
Migration files are auto-generated by the CLI. Manual edits should be done via model config changes.

Shows model definition, database configuration, and CLI usage to auto-generate a migration file.

// db.config.js module.exports = { database: 'test', username: 'root', password: '', host: 'localhost', dialect: 'mysql' }; // define/test.js (model definition) module.exports = { table_test1: { columns1: { type: 'INT', length: 11, allowNull: false, primaryKey: true, autoIncrement: true, comment: 'columns1 comment' }, columns2: { type: 'VARCHAR', length: 32, allowNull: false, comment: 'columns2 comment' }, columns3: { type: 'DECIMAL', length: 11, decimals: 2, defaultValue: 0, allowNull: true }, columns4: { type: 'DATETIME', comment: 'datetime' } }, indexes: { table_test1: [ { type: 'UNIQUE', fields: ['columns2'], name: 'index_columns2_un' }, { fields: ['columns3', 'columns4'], name: 'index_columns3_columns4' } ] } }; // Run CLI commands (terminal): // npm install -g easy-migrate // migrate create --define-path ./define/test --db-config-path ./db.config.js --migrations-path ./migrations
Debug
Known issues
gotchaOnly MySQL database is supported; other dialects like PostgreSQL or SQLite will fail.
fix
Use a different migration tool if you need multi-database support.
affects: <=1.1.6
gotchaLimited data types: only INT, VARCHAR, DECIMAL, DATETIME, DATE, TEXT, LONGTEXT are supported. Other types like FLOAT, DOUBLE, CHAR must be replaced.
fix
Use DECIMAL for FLOAT/DOUBLE, VARCHAR for CHAR. Check Sequelize documentation for compatible types.
affects: <=1.1.6
deprecatedThe package has not been updated since 2018 and relies on older Sequelize versions; newer Sequelize APIs may cause issues.
fix
Consider using a more actively maintained migration tool like db-migrate or sequelize-cli.
affects: 1.1.6
breakingThe CLI command 'migrate' may conflict with other migration tools that also use 'migrate' as a command.
fix
Use full path or rename alias to avoid conflicts.
affects: all
Errors
Common errors & fixes
dialect 'postgres' is not supported. Supported dialects: mysql
User set dialect to 'postgres' in db config, but only MySQL is supported.
fix
Change dialect to 'mysql' or use a different migration tool that supports PostgreSQL.
TypeError: Cannot read property 'INT' of undefined
Using unsupported data type like 'FLOAT' in model config; the tool only maps specific types.
fix
Replace 'FLOAT' with 'DECIMAL' in model definition.
Error: Column 'xyz' has no type defined
Model definition missing 'type' property for a column.
fix
Add a valid type (e.g., 'INT', 'VARCHAR', etc.) to the column configuration.
Upgrade
Version history
1.1.6latest on npm
Audit
Dependencies
sequelizerequiredUnderlying ORM for model management and database operations.
Agent activity
7 hits · last 30 days
node
6
Resources
easy-migrate — npm install easy-migrate · libregistry