Migration Tool for Postgres databases in node.js. Version 2.1.0 provides a simple migration framework using timestamped SQL files. It offers a CLI with add-migration and migrate commands, and a programmatic API via require('megrim'). Migrations are stored in schema/$timestamp-$name.sql and tracked in a schema_info table. Compared to more feature-rich tools like node-pg-migrate or Knex, megrim is minimal and does not support TypeScript, callbacks instead of Promises, and relies on the DATABASE_URL environment variable. It has been stable with minimal updates, suggesting maintenance mode.
npm install megrimNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to programmatically run migrations using the megrim function with a callback.
Consider using a migration tool with Promise/async support like node-pg-migrate.
Ensure files follow the timestamp format, e.g., 20250321120000-create-users.sql.
Set DATABASE_URL before running migrate command or passing connection programmatically.
Double-check the package name; ensure you are using the correct migration tool.
Run npm install megrim --save and ensure the module is listed in package.json.
Use const megrim = require('megrim'); and ensure no typos in the variable name.Run the migrate command once to create the schema_info table, or create it manually with: CREATE TABLE schema_info (version VARCHAR(255) PRIMARY KEY, applied_at TIMESTAMP DEFAULT NOW());