{"id":48511,"library":"migration-collection","title":"migration-collection","description":"A lightweight, extensible Node.js migration tool supporting filesystem, MSSQL, MariaDB, and PostgreSQL. Version 1.3.20 provides a modular pipeline (feeder, sorter, importer, parser, ledger, end) with customizable components. Steady release cadence; focuses on simplicity and easy extension compared to heavier frameworks like Knex or Umzug.","status":"active","version":"1.3.20","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/zetxx/migration-collection","tags":["javascript"],"install":[{"cmd":"npm install migration-collection","lang":"bash","label":"npm"},{"cmd":"yarn add migration-collection","lang":"bash","label":"yarn"},{"cmd":"pnpm add migration-collection","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Microsoft SQL Server support","package":"mssql","optional":true},{"reason":"MariaDB/MySQL support","package":"mysql2","optional":true},{"reason":"PostgreSQL support","package":"pg","optional":true}],"imports":[{"note":"Package uses CommonJS; ESM import not supported.","wrong":"import { MigrationCollection } from 'migration-collection'","symbol":"MigrationCollection","correct":"const { MigrationCollection } = require('migration-collection')"},{"note":"Also CommonJS named export.","wrong":"const FsFeeder = require('migration-collection').FsFeeder","symbol":"FsFeeder","correct":"const { FsFeeder } = require('migration-collection')"},{"note":"Named export for basic ledger implementation.","wrong":null,"symbol":"DefaultLedger","correct":"const { DefaultLedger } = require('migration-collection')"}],"quickstart":{"code":"const { MigrationCollection, FsFeeder, IntSorter, SqlImporter, SqlParser, DefaultLedger } = require('migration-collection');\n\nasync function runMigrations() {\n  const collection = new MigrationCollection({\n    feeder: new FsFeeder({ directory: './migrations', extension: '.sql' }),\n    sorter: new IntSorter(),\n    importer: new SqlImporter(),\n    parser: new SqlParser(),\n    ledger: new DefaultLedger({\n      migrate: async (file) => { /* custom migration logic */ },\n      isMigrated: async (name) => { /* check if already applied */ },\n      save: async (name) => { /* record migration */ },\n      delete: async (name) => { /* remove record */ }\n    })\n  });\n  const results = await collection.run();\n  console.log(results);\n}\nrunMigrations().catch(console.error);","lang":"javascript","description":"This example shows a complete migration setup with filesystem feeder, integer sorter, SQL importer/parser, and custom ledger functions."},"warnings":[{"fix":"Implement all four methods in the ledger object.","message":"Ledger methods (migrate, isMigrated, save, delete) must all be provided; they are not optional.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check both 'migrated' and any future field name after upgrading.","message":"The 'migrated' field in migration result objects is boolean but may be renamed in future versions.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure all migration filenames start with a numeric prefix followed by an underscore.","message":"Files are sorted by integer key extracted from filename (e.g., 121_abc.sql -> key 121). Non-numeric prefixes will be ignored.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.3.20':17 'cadenc':33 'collect':3 'compar':40 'compon':30 'customiz':29 'easi':38 'end':27 'extens':6,39 'feeder':22 'filesystem':11 'focus':34 'framework':43 'heavier':42 'import':24 'javascript':48 'knex':45 'ledger':26 'lightweight':5 'like':44 'mariadb':13 'migrat':2,8 'migration-collect':1 'modular':20 'mssql':12 'node.js':7 'parser':25 'pipelin':21 'postgresql':15 'provid':18 'releas':32 'simplic':36 'sorter':23 'steadi':31 'support':10 'tool':9 'umzug':47 'version':16","created_at":"2026-06-07T16:57:01.814382+00:00","updated_at":"2026-06-07T16:57:01.814382+00:00","problems":[{"fix":"npm install mssql","cause":"Optional peer dependency not installed when using SQL Server.","error":"Cannot find module 'mssql'"},{"fix":"Provide all ledger methods: migrate, isMigrated, save, delete.","cause":"Ledger object missing required method.","error":"Error: Ledger.migrate is not a function"},{"fix":"Implement read() method returning an array of file objects.","cause":"Custom feeder does not implement the required API.","error":"TypeError: feeder.read is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/zetxx/migration-collection/blob/master/README.md","github":"ssh://git@github.com/zetxx/migration-collection","docs":null,"changelog":null,"pypi":null,"npm":"migration-collection","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}