Registry / devops / migration-tool

migration-tool

JSON →
library0.1.1jsnpmunverified

A lightweight, zero-dependency migration tool for Node.js designed to manage database schema changes and data migrations. Current stable version is 0.1.1, released as an early-stage package with minimal feature set. It provides a simple CLI and programmatic API to run migrations with support for custom adapters. Compared to alternatives like node-pg-migrate or sequelize-cli, this offers a more minimal core with no built-in database adapters, focusing on flexibility.

npm install migration-tool
INSTALL
IMPORT
SIG · MIGRATION-TOOL
M
migration-tool
devopsjavascriptv0.1.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.

MigrationTool
import { MigrationTool } from 'migration-tool'
import MigrationTool from 'migration-tool'
Only named exports available; no default export.
runMigrations
import { runMigrations } from 'migration-tool'
const runMigrations = require('migration-tool').runMigrations
ESM-only package; CommonJS require will fail.
MigrationConfig
import type { MigrationConfig } from 'migration-tool'
TypeScript type import for configuring migrations.

Shows basic usage of MigrationTool with custom adapter and running all pending migrations.

import { MigrationTool } from 'migration-tool'; const tool = new MigrationTool({ migrationsDir: './migrations', adapter: async (query) => { /* custom adapter */ }, }); await tool.up(); console.log('Migrations complete');
Debug
Known issues
breakingESM-only: Module not found: Can't resolve 'migration-tool' when using require()
fix
Use import syntax or configure your bundler to handle ESM.
affects: >=0.1.0
gotchaNo built-in adapters: you must provide an adapter function or the tool will throw.
fix
Implement an adapter that executes SQL using your database driver (e.g., pg, mysql2).
affects: >=0.1.0
deprecatedThe 'MigrationTool' constructor's 'migrationsDir' option may be renamed in future versions.
fix
Check future changelog; currently no alternative.
affects: 0.1.0 - 0.1.1
gotchaNo rollback support: the 'down' method is not yet implemented.
fix
Manually revert migrations or wait for a future release.
affects: >=0.1.0
gotchaMigrations must export 'up' function; 'down' is optional but ignored currently.
fix
Ensure each migration module exports at least an 'up' function.
affects: all
Errors
Common errors & fixes
Error: No adapter provided
Missing adapter option in MigrationTool constructor.
fix
Pass an adapter function: new MigrationTool({ adapter: async (query) => { /* ... */ } })
TypeError: (0 , migration_tool.MigrationTool) is not a constructor
Named import mistakenly used as default import or CommonJS require mishandled.
fix
Use import { MigrationTool } from 'migration-tool'
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'migration-tool'
Using require() in a CJS context; package is ESM-only.
fix
Convert your project to ESM ("type": "module") or use dynamic import().
Migration file must export an 'up' function
Migration module missing a named export 'up'.
fix
Export a function named 'up' from each migration file.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
3 hits · last 30 days
node
2
Amazon
1
Resources