Registry / database / migro
library0.2.3jsnpmunverified

Lightweight database migration tool for Node.js supporting PostgreSQL and MySQL. Current stable version is 0.2.3, released as a minimal CLI tool with no runtime dependencies. It uses a JSON config file (.migrorc) and organizes migrations by version and database, with alphabetical sorting. Unlike more full-featured tools like Knex or Umzug, Migro is simple and focused, but has limited driver support (only PostgreSQL actively) and is not actively maintained. Compatible with Node >=10.

npm install migro
INSTALL
IMPORT
SIG · MIGRO
M
migro
databasejavascriptv0.2.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.

migro
npx migro up main
Migro is a CLI tool, not a library. Use via command line or npx.

Initialize a PostgreSQL database, create a version and migration, then apply it.

npm install -g migro # create .migrorc cat > .migrorc <<EOF { "database": { "main": { "host": "localhost", "port": 5432, "user": "postgres", "password": "" } } } EOF export PGPASSWORD='S3cur3P@55w0rd' migro create-version main 0.0.1 migro create main create-users-table # Edit migrations/main/0.0.1/*.js echo 'exports.up = (db) => db.query(`CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT)`)' > migrations/main/0.0.1/$(ls migrations/main/0.0.1/ | head -1) migro up main
Debug
Known issues
gotchaThe 'driver' option defaults to 'pg' and only 'pg' is currently supported. MySQL is not implemented.
fix
Use only PostgreSQL. Do not expect MySQL support.
affects: >=0.0.0
deprecatedThe package uses semistandard style and Travis CI, but the GitHub repo appears unmaintained since 2018.
fix
Consider alternatives like Umzug or Knex migrations.
affects: >=0.0.0
gotchaThe config file must be named '.migrorc' and placed in the project root or specified via -w. No other formats supported.
fix
Ensure .migrorc is present and valid JSON.
affects: >=0.0.0
gotchaVersion directories are sorted alphabetically; using semantic versioning like '0.0.9' and '0.0.10' will sort incorrectly as strings.
fix
Pad versions: '0.0.09', '0.0.10'.
affects: >=0.0.0
gotchaMigrations are JavaScript files that must export 'up' and 'down' functions. They receive a database connection object, not a knex instance.
fix
Write exports.up = (db) => db.query('...') and exports.down = (db) => db.query('...').
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'pg'
pg is not installed as a dependency; it's expected to be in your project.
fix
npm install pg
Error: connect ECONNREFUSED 127.0.0.1:5432
PostgreSQL is not running or host/port misconfigured.
fix
Start PostgreSQL or check .migrorc connection settings.
Error: Cannot find module '/path/to/migrations/main/0.0.1/...js'
Migration file path issue or missing version directory.
fix
Ensure the version exists: migro create-version main 0.0.1, then create migration.
migro: command not found
Installed locally; use npx or install globally.
fix
npm install -g migro
Upgrade
Version history
0.2.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
packagemigro
migro — npm install migro · libregistry