Registry / database / east-postgres

east-postgres

JSON →
library1.0.2jsnpmunverified

PostgreSQL adapter for the East database migration tool. This package provides the bridge between East (a Node.js migration framework) and node-postgres (pg) to manage PostgreSQL migrations. Version 1.0.2 is the current stable release. It stores executed migration names in a `_migrations` table and passes a `db` client instance to migration functions. The package requires explicit peer dependency on pg (>=4.x.x <=7.x.x). Compared to other migration tools like Knex or Umzug, East is minimal and follows a convention-over-configuration approach with a simple CLI.

npm install east-postgres
INSTALL
IMPORT
SIG · EAST-POSTGRES
E
east-postgres
databasejavascriptv1.0.2
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.

migrate
exports.migrate = function(client, done) { ... }
module.exports = { migrate: ... }
CommonJS export style required by East. Use exports.migrate, not module.exports.
rollback
exports.rollback = function(client, done) { ... }
module.exports = { rollback: ... }
Same as migrate, must be attached to exports.
client
function(client, done) { var db = client.db; ... }
function(db, done) { ... }
The first argument is a client object with a .db property, not the db directly.
default
const eastPostgres = require('east-postgres')
import eastPostgres from 'east-postgres'
This package uses CommonJS; ESM import is not supported.

Shows how to set up East with east-postgres, create a migration file, and define migrate/rollback functions using the provided db client from the pg library.

// 1. Initialize east in your project: // east init // 2. Create .eastrc with adapter and PostgreSQL connection URL: // { // "adapter": "east-postgres", // "url": "postgres://user:password@127.0.0.1:5432/database" // } // 3. Create a migration: // east create apples // 4. Edit the migration file (e.g., 1_apples.js): exports.migrate = function(client, done) { var db = client.db; db.run('CREATE TABLE things (id serial primary key, name text, color text)', function(err) { if (err) return done(err); done(); }); }; exports.rollback = function(client, done) { var db = client.db; db.run('DROP TABLE IF EXISTS things', done); }; // 5. Run migrations: // east migrate
Debug
Known issues
breakingRequires pg peer dependency version 4.x.x to 7.x.x. Newer pg versions (>7) may cause incompatibility.
fix
Pin pg to version <8.0.0 (e.g., npm install pg@^7.5.0).
affects: >=1.0.0
deprecatedPackage is no longer maintained and has not been updated since 2016. The East migration framework itself is also largely unmaintained.
fix
Consider migrating to a modern alternative like node-pg-migrate, Umzug, or Knex migrations.
affects: *
gotchaThe migration history table is named `_migrations` by default, which may conflict with existing tables or expectations.
fix
Rename the table by configuring East's options (if supported) or accept the default name.
affects: *
gotchaThe `client` parameter to migrate/rollback is not a pg.Client directly; it's an object with a `.db` property that is the actual pg.Client instance.
fix
Always access client.db to get the pg client.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'east-postgres'
Package not installed or not found in node_modules.
fix
Run: npm install east east-postgres -g (or locally without -g).
Error: connect ECONNREFUSED 127.0.0.1:5432
PostgreSQL server is not running or connection URL is incorrect.
fix
Ensure PostgreSQL is running on the specified host/port. Check .eastrc url value.
TypeError: db.run is not a function
Using client.db incorrectly or the pg client version is incompatible.
fix
Ensure you are accessing client.db (not client directly) and that pg version is between 4 and 7.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
pgrequiredPeer dependency: node-postgres client used to connect and run queries against PostgreSQL.
eastrequiredPeer dependency: the core migration framework that this adapter extends.
Agent activity
5 hits · last 30 days
node
4
Resources
east-postgres — npm install east-postgres · libregistry