Registry / database / marv-pg-driver

marv-pg-driver

JSON →
library5.0.0jsnpmunverified

A PostgreSQL driver for the marv database migration tool, version 5.0.0. Maintained as part of the Guidesmiths ecosystem. Supports both Promise and callback APIs. Requires Node >=10 and peer dependency pg ^7.0.0 || ^8.0.0. Provides a simple interface to run SQL migrations from a directory against a PostgreSQL database using a connection object passed to pg.Client.

npm install marv-pg-driver
INSTALL
IMPORT
SIG · MARV-PG-DRIVER
M
marv-pg-driver
databasejavascriptv5.0.0
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.

default
const driver = require('marv-pg-driver')
import driver from 'marv-pg-driver'
This package is CommonJS-only; no ESM exports. Always use require().

Shows Promise-based usage with marv-pg-driver, scanning SQL migration files and applying them.

const marv = require('marv/api/promise'); const driver = require('marv-pg-driver'); const path = require('path'); const directory = path.resolve('migrations'); const connection = { host: process.env.PGHOST ?? 'localhost', port: parseInt(process.env.PGPORT ?? '5432'), database: process.env.PGDATABASE ?? 'mydb', user: process.env.PGUSER ?? 'postgres', password: process.env.PGPASSWORD ?? '', }; (async () => { const migrations = await marv.scan(directory); await marv.migrate(migrations, driver({ connection })); console.log('Migrations applied successfully'); })();
Debug
Known issues
gotchaThe connection object is passed directly to pg.Client constructor; ensure all required PostgreSQL connection properties are provided.
fix
Include at least host and database; use environment variables or config.
affects: >=1.0.0
gotchaMigrations must be SQL files in a directory; directory path must be absolute (use path.resolve).
fix
Always use path.resolve(__dirname, 'migrations') or similar.
affects: >=1.0.0
gotchaThe driver function must be called (driver({ connection })) not passed as reference.
fix
Pass the result of driver({ connection }) to marv.migrate.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'marv-pg-driver'
Package not installed or missing in node_modules.
fix
Run npm install marv-pg-driver
Cannot read property 'connect' of undefined
Connection object is undefined or missing required properties for pg.Client.
fix
Ensure connection object is properly defined with host, database, user, password etc.
marv.migrate is not a function
Using wrong API (require('marv') vs require('marv/api/promise') or require('marv/api/callback')).
fix
Use const marv = require('marv/api/promise') for Promise API.
Upgrade
Version history
5.0.0latest on npm
Audit
Dependencies
pgrequiredPeer dependency: PostgreSQL client driver
Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
marv-pg-driver — npm install marv-pg-driver · libregistry