A CLI tool for managing versioned MySQL schema migrations with TypeScript support, transaction-based rollbacks, and dry-run previews. Current stable version is 1.4.0, released under a custom license and requiring Node.js >=18. It supports multiple databases, timestamped migration files, forward/backward batch execution, and CI/CD integration. Key differentiators include automatic transactional rollback on failure, built-in dry-run mode, CommonJS/ESM conversion utilities, and full TypeScript type definitions. The tool uses a JSON configuration file and relies on mysql2 for database connections.
npm install mysql-migrationNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize project, create a migration, preview it with dry-run, then apply it with transaction support.
Upgrade Node.js to 18 or later.
Ensure config file is at <project>/migrations/mysql-migration.config.json or specify custom path.
Use --transaction for actual validation via rollback on failure.
Run npx mysql-migration to-esm <dbName> to convert to ESM.
Upgrade to >=1.3.0 for batch rollback support.
Install mysql2: npm install mysql2
Verify host, port, and network connectivity in config.
Check user, password, and host in mysql-migration.config.json.
Create the database: CREATE DATABASE db_name;