Automatic MySQL database migration and schema synchronization tool. Version 1.1.6. It reads 'CREATE TABLE' .sql files and automatically syncs the database schema to match those definitions. Features include upgrade (versioned, irreversible migration with logging and rollback protection) and autoSync (development-only automatic schema sync with risk assessment). Only supports MySQL. Release cadence: actively maintained with periodic updates. Key differentiator: full automation of schema synchronization based on single source of truth (DDL files), with no manual migration scripts needed for common changes.
npm install db-auto-migrateNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic setup to perform an upgrade migration using db-auto-migrate with configuration from environment variables.
Set `env` to anything other than 'development' (e.g., 'production') when deploying. Or set `autoSync: 'off'` or `'manual'`.
Ensure `tempDb.database` begins with '__temp_sync__'.
Do not edit old upgrade files; add new ones with higher version numbers.
Pass an object with those methods or set to `false` to suppress logs.
Set `tempDb.database` to a string starting with '__temp_sync__', e.g., '__temp_sync__migration'.
Use `const Migration = require('db-auto-migrate');` and then `new Migration(options)`.Set `env: 'development'` for development, or change `autoSync` to 'manual' or 'off' in production.