A TypeScript-based MySQL migration tool supporting mysql and mysql2 drivers. Current stable version is 1.1.2, published via npm. It provides programmatic API for upgrade, downgrade, reset, and initialization of migration scripts. Features include timestamp-based migration naming to avoid branch conflicts, strict ordering via environment variables (MIGRATIONS_STRICT_ORDER, MIGRATIONS_NUMERIC_ORDER), and dotenv support for configuration. Key differentiators: first-class TypeScript support (built-in types), dual driver compatibility, and flexible ordering control.
npm install ts-mysql-migrateNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows full initialization and migration execution with environment variable configuration.
Set MIGRATIONS_STRICT_ORDER=false or pass strictOrder: false to constructor explicitly in development.
Ensure each migration file exports async functions named upgrade and downgrade.
Either set MIGRATIONS_NUMERIC_ORDER=false or rename old migrations to use timestamps.
Switch to mysql2 driver for future compatibility.
Install dotenv: npm install dotenv
Verify DB_USER, DB_PASSWORD, DB_HOST, DB_PORT, DB_DATABASE environment variables.
Use import { Migrator } from 'ts-mysql-migrate'Add export async function upgrade(queryFn) { ... } to the migration file.