pgmg is a forward-only, idempotent PostgreSQL migration tool that focuses on minimal magic and simplicity. Version 0.0.11 (pre-1.0) uses postgres.js to run migrations defined as ES modules exporting a transaction function. It stores migration metadata in a pgmg.migration table within the target database, enabling easy reset for development. Unlike tools like node-pg-migrate or db-migrate, pgmg avoids complex configuration and ordering, relying on glob order and idempotent execution. The package is experimental and has sparse documentation.
npm install pgmgNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a migration file with a named transaction function. The CLI runs it against a PostgreSQL connection string.
Rename migration files to .mjs or set "type": "module" in package.json.
Use npx pgm "$DATABASE_URL" ./migrations/*.mjs (quotes around glob if needed).
Do not drop schema pgmg in production unless you intend to re-run all migrations.
Specify "pgmg": "0.0.11" in dependencies to avoid unintended upgrades.
Rename migration file to .mjs or add "type": "module" to package.json.
Stop the existing PostgreSQL service or change the port in the connection string.
Verify the migration directory exists and contains .mjs files; try using absolute paths.