dbsync is a schema migration and database change management tool similar to Flyway but unopinionated and flexible. It scans a directory for SQL migration files and applies them in order, tracking which have been run. Version 2.0.0 (stable, current) includes a breaking change removing the need to manually escape '?' characters in migrations. Supports any database supported by Knex.js (Postgres, MySQL, MariaDB, SQLite3, Oracle experimental). Release cadence is irregular; maintained as of 2023.
npm install dbsyncNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Programmatic migration with dbsync using ESM import and configuration object.
Remove any manual escaping of '?' in migration files before upgrading to v2.0.0.
Use ESM import statements: import dbsync from 'dbsync'
Ensure migration filenames follow a consistent naming scheme (e.g., YYYYMMDDHHMMSS_description.sql) to enforce order.
Install knex and a database driver (e.g., pg, mysql, sqlite3) before using dbsync.
Run: npm install knex
Use mysql2 instead of mysql: npm install mysql2
Ensure the database user has CREATE TABLE permissions.
Switch to ESM import (import dbsync from 'dbsync') or use dynamic import (const dbsync = await import('dbsync')).