Registry / database / mysql-transit

mysql-transit

JSON →
library0.0.9jsnpmunverified

MySQL database migration tool that compares two databases and applies schema changes from a source (new) to a target (original) database. Version 0.0.9 is the latest stable release; there is no defined release cadence. Key differentiator: built-in interactive mode prompting for confirmation before executing queries, supporting both MySQL and MariaDB.

npm install mysql-transit
INSTALL
IMPORT
SIG · MYSQL-TRANSIT
M
mysql-transit
databasejavascriptv0.0.9
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.

MysqlTransit
const MysqlTransit = require('mysql-transit')
import MysqlTransit from 'mysql-transit'
Package uses CommonJS; no ESM or TypeScript types provided.
MysqlTransit instance
new MysqlTransit('originalDB', 'newDb', { host, port, user, password })
new MysqlTransit({ original: 'originalDB', target: 'newDb', ... })
Constructor expects database names as first two arguments, then connection config object.
transit method
instance.transit({ interactive: true }, callback)
instance.transit({}, callback) without handling interactive
interactive defaults to true; set to false for unattended execution.

Demonstrates basic setup and non-interactive migration from 'newDb' to 'originalDB'.

const MysqlTransit = require('mysql-transit'); const transit = new MysqlTransit('originalDB', 'newDb', { host: 'localhost', port: 3306, user: 'root', password: process.env.MYSQL_PASSWORD ?? '' }); transit.transit({ interactive: false }, function(err, result) { if (err) { console.error('Migration failed:', err); return; } console.log('Migration completed successfully'); });
Debug
Known issues
breakingPackage uses synchronous-like callback pattern; no promise or async/await support.
fix
Wrap in Promise or use util.promisify for async/await.
affects: >=0.0.0
gotchaConstructor expects database names as separate string arguments, not a single config object.
fix
Pass first argument as original DB name, second as new DB name.
affects: >=0.0.0
gotchaThe transit method may execute destructive ALTER/DROP queries; always test with non-production databases first.
fix
Set interactive: true to review queries before execution.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: MysqlTransit is not a constructor
Incorrect import or require path.
fix
Use const MysqlTransit = require('mysql-transit'); then new MysqlTransit(...)
Error: getaddrinfo ENOTFOUND
Database host not reachable.
fix
Check hostname and network connectivity; ensure MySQL server is running.
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'
Invalid credentials or insufficient privileges.
fix
Verify user, password, and grant required permissions on both databases.
Upgrade
Version history
0.0.9latest on npm
Audit
Dependencies
mysqlrequiredMySQL database driver for Node.js
Agent activity
4 hits · last 30 days
node
4
Resources
mysql-transit — npm install mysql-transit · libregistry