Registry / database / migry
library0.4.1jsnpmunverified

Migry is a simplistic MongoDB migration manager built specifically for Mongoose. Current stable version is 0.4.1, with no recent updates (last release likely 2019). It provides a CLI and programmatic API to create, list, and run migrations using JavaScript files that export an async function. Key differentiators: lightweight, no external dependencies besides Mongoose 5.x, and supports per-environment config with TLS options. Compared to alternatives like migrate-mongo, Migry has far fewer features and no active maintenance. Suitable for small projects that already use Mongoose and need a minimal migration runner. Use cautiously: peer dependency on Mongoose 5.x, no support for Mongoose 6+, and potential security risks from unverified npm package.

npm install migry
INSTALL
IMPORT
SIG · MIGRY
M
migry
databasejavascriptv0.4.1
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.

migry
✓ const migry = require('migry');
✗ import migry from 'migry';
CommonJS only; ESM import may cause errors. Use require() for compatibility.
migry.CLI
✓ const CLI = require('migry').CLI;
✗ const { CLI } = require('migry');
The CLI constructor is exported as a property of the main module. Destructuring works, but direct require is safer if using older Node versions.
migry.Migrator
✓ const Migrator = require('migry').Migrator;
✗ import { Migrator } from 'migry';
Migrator is also a property export; ESM imports will fail. Use CommonJS.

Shows basic setup and usage: install, init folder, create a migration, edit it, and run all pending migrations.

// Step 1: Install dependencies // npm install migry mongoose // Step 2: Initialize migration folder // npx migry init // Step 3: Create a migration file // npx migry create add-users // Step 4: Edit the generated file (e.g., migrations/1630000000000-add-users.js) // migrations/1630000000000-add-users.js const mongoose = require('mongoose'); async function migrate() { const db = mongoose.connection.db; await db.collection('users').insertOne({ name: 'test' }); console.log('Migration completed'); } module.exports = migrate; // Step 5: Run migrations // npx migry run
Debug
Known issues
breakingRequires Mongoose 5.x, incompatible with Mongoose 6+ due to changes in connection API.
fix
Downgrade Mongoose to 5.x or use a different migration tool that supports Mongoose 6+.
affects: <=0.4.1
deprecatedPackage has not been updated since 2019; no support for newer Node.js versions or ESM.
fix
Consider migrating to actively maintained alternatives like migrate-mongo or mongodb-migrate.
affects: >=0.0.1
gotchaCLI commands must be run from the project root; does not respect custom migration directory paths in config.
fix
Run commands in the directory where migrations/config.json exists.
affects: >=0.0.1
gotchaMigration files must export a single async function; any other export pattern will cause silent failures.
fix
Ensure migration files export an async function using module.exports = async function() { ... }.
affects: >=0.0.1
breakingPeer dependency mongoose is required; missing mongoose will cause runtime error when running migrations.
fix
Install mongoose as a dependency: npm install mongoose@5
affects: >=0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'mongoose'
Mongoose not installed or not in node_modules.
fix
Run 'npm install mongoose' to install the peer dependency.
TypeError: migry.CLI is not a constructor
fix
const CLI = require('migry').CLI;
Upgrade
Version history
0.4.1latest on npm
Audit
Dependencies
mongooserequiredMongoose is a peer dependency required at runtime for database connection and migration execution.
Agent activity
16 hits · last 30 days
node
14
Resources
packagemigry ↗
migry — npm install migry · libregistry