Registry / devops / migrate-js

migrate-js

JSON →
library0.0.8jsnpmunverified

A flexible migration tool for Node.js that works both from the CLI and programmatically. Current stable version is 0.0.8, with no recent releases or active development. It allows customization of state storage (via state managers) and migration templates. Compared to alternatives like `node-pg-migrate` or `db-migrate`, it is minimal and unopinionated, but lacks active maintenance and has limited community adoption. The package requires Node.js >= 4.3.2.

npm install migrate-js
INSTALL
IMPORT
SIG · MIGRATE-JS
M
migrate-js
devopsjavascriptv0.0.8
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.

default
import Migrate from 'migrate-js'
const { Migrate } = require('migrate-js')
The package exports a single constructor function as default export. ESM usage requires an environment that supports ES modules.
Migrate
const Migrate = require('migrate-js')
import { Migrate } from 'migrate-js'
CommonJS require returns the constructor directly, not an object. Named import will fail.
None
npx migrate-js up
npx migrate up
The CLI command is 'migrate-js', not 'migrate'. There is a separate package 'migrate' which is different.

Programmatically run all pending migrations using the JSON state manager and default migration directory.

const Migrate = require('migrate-js'); const path = require('path'); const instance = new Migrate({ stateManager: 'json', migrationsDirectory: path.join(__dirname, 'migrations'), }); instance.up().then(() => { console.log('Migrations applied successfully'); }).catch(err => { console.error('Migration failed:', err); });
Debug
Known issues
deprecatedPackage is no longer actively maintained
fix
Consider alternatives like 'node-pg-migrate' or 'db-migrate'.
affects: >=0.0.0
gotchaCLI command is 'migrate-js', not 'migrate'; running 'npx migrate' will invoke a different package
fix
Always use 'npx migrate-js' for CLI commands.
affects: >=0.0.0
gotchaCommonJS require returns constructor directly, not an object with properties
fix
Use const Migrate = require('migrate-js') and not destructuring.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'commander'
Optional dependency commander is not installed automatically; npm may skip optional deps in some environments.
fix
Explicitly install commander: npm install commander
TypeError: Migrate is not a constructor
Incorrect import: using named import { Migrate } from 'migrate-js' or destructuring require.
fix
Use const Migrate = require('migrate-js') (CommonJS) or import Migrate from 'migrate-js' (ESM).
Upgrade
Version history
0.0.8latest on npm
Audit
Dependencies
commanderoptionalUsed for CLI argument parsing
Agent activity
8 hits · last 30 days
node
8
Resources
migrate-js — npm install migrate-js · libregistry