Utilities for parsing SQL-based migration files with versioned up/down sections. Version 0.4.3 is stable, with infrequent releases. It provides functions like findMigrationFilenames, readMigrationFile, and parseMigrationFile to scan a directory for migration files of format `NNN-name.sql` and extract up/down SQL statements separated by `-- Up` / `-- Down` markers. Unlike heavier frameworks (e.g., knex, Sequelize migrations), this is a lightweight, file-oriented library focused solely on reading and parsing migration files, leaving execution to the user.
npm install migration-filesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates scanning a directory for migration files and reading each into a structured object.
Rename files to match `\d+-.+\.sql` pattern, e.g., `001-initial.sql`.
Follow the exact format: 80 dashes, newline, `-- Up` (or `-- Down`), newline, 80 dashes.
Use `import` statements and ensure your project is configured for ESM (e.g., `"type": "module"` in package.json).
Use import syntax and set 'type':'module' in package.json.
Switch to ES modules or use dynamic import().