migrate-semver is a database-agnostic Node.js library that manages migrations based on SemVer version strings rather than sequential numbers or timestamps. Version 0.7.0 is the latest stable release, with infrequent updates. It provides a SemVerMigration class that scans a migrations directory for versioned folders and runs only the migrations needed to reach a target version. Unlike timestamp-based tools, it allows arbitrary version jumps and skips already applied versions. It requires a plugin for database-specific storage, with a Mongoose plugin available. The library handles connections, migration tracking, and custom options passed to migrations.
npm install migrate-semverNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to instantiate SemVerMigration with a plugin, connect, check migration feasibility, and run an up migration to a specific SemVer version.
Ensure the path exists and has at least one versioned subfolder (e.g., 0.1.0/).
Manually handle rollbacks outside of migrate-semver or implement a custom plugin with down logic.
Use promisify or switch to a Promise-based wrapper if available.
Pass a valid plugin object with hasMigrationsTable, createMigrationsTable, etc.
Wrap your plugin object in a function: plugin() returns the object.
Create the directory with versioned subfolders or correct the path.
Ensure a folder named exactly '0.3.0' exists with an index-up.js file.