Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
MigrationCollection
✓ const { MigrationCollection } = require('migration-collection')
✗ import { MigrationCollection } from 'migration-collection'
Package uses CommonJS; ESM import not supported.
FsFeeder
✓ const { FsFeeder } = require('migration-collection')
✗ const FsFeeder = require('migration-collection').FsFeeder
Also CommonJS named export.
DefaultLedger
✓ const { DefaultLedger } = require('migration-collection')
Named export for basic ledger implementation.
This example shows a complete migration setup with filesystem feeder, integer sorter, SQL importer/parser, and custom ledger functions.
const { MigrationCollection, FsFeeder, IntSorter, SqlImporter, SqlParser, DefaultLedger } = require('migration-collection');
async function runMigrations() {
const collection = new MigrationCollection({
feeder: new FsFeeder({ directory: './migrations', extension: '.sql' }),
sorter: new IntSorter(),
importer: new SqlImporter(),
parser: new SqlParser(),
ledger: new DefaultLedger({
migrate: async (file) => { /* custom migration logic */ },
isMigrated: async (name) => { /* check if already applied */ },
save: async (name) => { /* record migration */ },
delete: async (name) => { /* remove record */ }
})
});
const results = await collection.run();
console.log(results);
}
runMigrations().catch(console.error);
Errors
Common errors & fixes
Cannot find module 'mssql'
Optional peer dependency not installed when using SQL Server.
Error: Ledger.migrate is not a function
Ledger object missing required method.
fixProvide all ledger methods: migrate, isMigrated, save, delete.
TypeError: feeder.read is not a function
Custom feeder does not implement the required API.
fixImplement read() method returning an array of file objects.
Audit
Dependencies
mssqloptionalMicrosoft SQL Server support
mysql2optionalMariaDB/MySQL support
pgoptionalPostgreSQL support