Registry / database / pg-upmig

pg-upmig

JSON →
library0.0.30jsnpmunverified

A forward-only PostgreSQL migration tool (v0.0.30) that discourages rollbacks and forces developers to think of migrations as whole units. It supports both SQL and programmatic JavaScript migrations, and integrates with a custom PostgreSQL client or the default node-postgres driver. Configurable via environment variables or .upmigrc.js. Less popular than node-pg-migrate or db-migrate, but offers a unique philosophy of no rollbacks.

npm install pg-upmig
INSTALL
IMPORT
SIG · PG-UPMIG
P
pg-upmig
databasejavascriptv0.0.30
harness data pending
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.

upmig
✓ const upmig = require('pg-upmig');
✗ import upmig from 'pg-upmig';
Package is CommonJS-only; no ESM support.
migration instance
✓ const migration = new upmig({...});
✗ const migration = upmig.create({...});
Constructor must be called with 'new'
migration.up()
✓ migration.up({ steps: 2 }).then(...);
✗ migration.up(2).then(...);
steps must be passed as an object property, not as a number.

Shows how to instantiate the migrator with a connection and apply one pending migration.

const upmig = require('pg-upmig'); const migration = new upmig({ options: { migrations: './migrations', table: 'pg_upmig', debug: false }, connection: { host: 'localhost', port: 5432, database: 'mydb', user: 'postgres', password: process.env.PGPASSWORD ?? '' } }); migration.up({ steps: 1 }) .then(() => console.log('Migration applied')) .catch(err => console.error(err));
Debug
Known issues
gotchaMigrations are forward-only — no rollback mechanism. If a migration alters data, you cannot revert automatically.
fix
Design migrations to be idempotent or handle rollbacks manually via additional SQL scripts.
affects: >=0.0.1
gotchaJS migration files must export a CommonJS function returning a Promise. If you export an ESM default or a non-function, it will fail silently or throw.
fix
Use `module.exports = (client, method) => { return new Promise(...); }`
affects: >=0.0.1
gotchaIf you use a custom client, it must expose `query`, `connect`, and `end` methods (or those configured via options).
fix
Ensure your client wrapper implements these methods with the expected signatures.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: migration.up is not a function
Forgot to instantiate with `new` or imported incorrectly.
fix
Use `const migration = new upmig(...);`
Error: connect ECONNREFUSED
PostgreSQL server not running or wrong connection parameters.
fix
Check host, port, and that the database is accessible.
Migration table pg_upmig does not exist
First run: the tool creates the table automatically but may fail if connection lacks permissions.
fix
Ensure the database user has CREATE TABLE privilege.
Upgrade
Version history
0.0.30latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
Resources
pg-upmig — npm install pg-upmig · libregistry