A lightweight migration tool for MySQL databases that runs SQL files sequentially. Current stable version is 0.4.0. Designed for simplicity—no down migrations, just numbered SQL files in a directory. Integrates via CLI or programmatic API. Differentiates by being minimal and easy to set up compared to more complex migration frameworks like db-migrate or node-migrate.
npm install migrate-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to run migrations programmatically using environment variables for database credentials.
Switch to ESM by adding 'type': 'module' to your package.json or use .mjs extension.
Run 'npx mysql-migrate' (with hyphen) not 'migrate-mysql'.
Use async/await or .then() instead of callback pattern.
Use leading zeros (e.g., 001, 002) to ensure correct ordering.
Manually write reverse SQL scripts if needed, or consider using a different tool.
Use dotenv or explicitly pass all options to migrate().
Install with 'npm install mysql-migrate --save-dev' and import as 'import migrate from 'mysql-migrate'.
Use 'import { migrate } from 'mysql-migrate' instead of default import.Ensure the migrations folder exists at the specified path (default './migrations').
Check your .env file or options object: DB_USER, DB_PASS, DB_HOST, etc.