Registry / database / data-elevator-postgres

data-elevator-postgres

JSON →
library6.0.0jsnpmunverified

A flexible Postgres database migration tool that stores migration levels in the database itself, enabling safe concurrent migrations across multiple instances (e.g., development teams or production servers). Version 6.0.0 requires Node >=18. Uses the 'data-elevator' core for migration logic and 'pg' for Postgres connectivity. Unlike many migration libraries, it stores state in a user-defined table rather than a file, making it ideal for shared database environments.

npm install data-elevator-postgres
INSTALL
IMPORT
SIG · DATA-ELEVATOR-POST
D
data-elevator-postgres
databasejavascriptv6.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
import DataElevatorPostgres from 'data-elevator-postgres'
const DataElevatorPostgres = require('data-elevator-postgres')
ESM-only since v6. CommonJS require will fail.
construct
npx data-elevator-postgres construct
node ./node_modules/data-elevator-postgres/build/construct.js
Use npx or the CLI command; direct path to internal scripts is unsupported.
MoveToTop
import { moveToTop } from 'data-elevator-postgres'
import { MoveToTop } from 'data-elevator-postgres'
Functions are camelCase, not PascalCase. Check docs for exact names.

Install, construct a new elevator, create a migration, edit the SQL, then run migrations up/down/to a specific level.

npm install data-elevator-postgres export DATABASE_URL='postgres://user:pass@localhost:5432/mydb' npx data-elevator-postgres construct npx data-elevator add 'add phone number to users' # edit generated floor file in ./data-elevator/floors/ npx data-elevator move top npx data-elevator move ground npx data-elevator move 2
Debug
Known issues
breakingESM-only: v6 drops CommonJS support. 'require' will throw MODULE_NOT_FOUND.
fix
Switch your project to ESM (type: module in package.json) and use import syntax.
affects: >=6.0.0
breakingNode.js version requirement changed to >=18 in v6.
fix
Upgrade Node.js to version 18 or later.
affects: >=6.0.0
deprecatedThe 'construct' command is deprecated in v6; use 'npx data-elevator-postgres init' instead.
fix
Replace 'construct' with 'init' in your workflow.
affects: >=6.0.0
gotchaDatabase connection string must be in the environment variable DATABASE_URL. If not set, the tool will fail without a clear error.
fix
Ensure DATABASE_URL is exported before running any command.
affects: >=6.0.0
gotchaThe migrations table name defaults to '_data_elevator' and must not conflict with existing tables; otherwise migrations will fail silently.
fix
Set a custom table name in config.levelControllerConfig.tableName to avoid conflicts.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'data-elevator-postgres'
Using require() with ESM-only package in v6.
fix
Change to import syntax or enable ESM in your project.
Error: connect ECONNREFUSED 127.0.0.1:5432
Postgres service is not running or DATABASE_URL is misconfigured.
fix
Start PostgreSQL service and verify DATABASE_URL is correctly set.
Error: relation "_data_elevator" does not exist
The migrations table was not created (construct/init not run) or misconfigured.
fix
Run 'npx data-elevator-postgres init' to create the table.
Upgrade
Version history
6.0.0latest on npm
Audit
Dependencies
data-elevatorrequiredCore migration framework; this package extends it with Postgres state storage.
pgrequiredPostgreSQL client library for database connections.
Agent activity
9 hits · last 30 days
node
8
Resources
data-elevator-postgres — npm install data-elevator-postgres · libregistry