Registry / database / exodusjs

exodusjs

JSON →
library2.1.1jsnpmunverified

exodusjs is a simple PostgreSQL database migration tool for Node.js. Version 2.1.1 is stable, with infrequent releases. It provides a CLI for creating, migrating, and rolling back migrations, tracking applied migrations in a dedicated database table. Unlike more feature-rich tools like node-pg-migrate or db-migrate, exodusjs focuses on minimalism: migrations are plain SQL in JavaScript modules with only 'up' and 'down' exported. No schema management, no seeding, no TypeScript support. Requires a DATABASE_URL environment variable and a local postgres connection.

npm install exodusjs
INSTALL
IMPORT
SIG · EXODUSJS
E
exodusjs
databasejavascriptv2.1.1
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.

migration (from migration file)
✓ module.exports = { up: 'SQL...', down: 'SQL...' }
✗ export default { up, down }
Migration files use CommonJS module.exports. ES module syntax is not supported.
exodus CLI
✓ npx exodus migrate
✗ exodus migrate (without npx if not globally installed)
Install locally with --save-dev and use npx to run the CLI.
DATABASE_URL (environment variable)
✓ process.env.DATABASE_URL
✗ hardcoded connection string
The CLI reads DATABASE_URL from the environment. Must be a valid PostgreSQL connection string.

Shows the full workflow: install, create a migration file, run it against PostgreSQL, and rollback.

// Install exodusjs as a dev dependency // npm i -D exodusjs // Set up database URL // export DATABASE_URL=postgres://user:password@localhost:5432/mydb // Create a migration // npx exodus create create-users-table // This generates migrations/20250210120001-create-users-table.js with template // Edit the migration file: var migration = { up: ` create table users ( id serial primary key, name text not null ); `, down: ` drop table users; ` }; module.exports = migration; // Run migrations // npx exodus migrate // Rollback if needed // npx exodus rollback
Debug
Known issues
gotchaMigrations are executed in alphabetical order by filename. Ensure timestamps are formatted correctly (e.g., YYYYMMDDHHMMSS) to maintain order.
fix
Use the CLI's 'create' command which auto-generates a timestamp prefix.
affects: *
breakingexodusjs requires node-postgres (pg) as a peer dependency. It does not bundle it.
fix
Run 'npm install pg' alongside exodusjs.
affects: >=2.0.0
deprecatedThe CLI has no built-in validation for SQL syntax. A migration with invalid SQL will fail at runtime.
fix
Always test your SQL against the database before running 'exodus migrate'.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'pg'
Missing peer dependency pg
fix
npm install pg --save-dev
Error: connect ECONNREFUSED 127.0.0.1:5432
PostgreSQL server not running or DATABASE_URL incorrect
fix
Verify PostgreSQL is running and DATABASE_URL env var is correct.
[EXODUS] Table "migrations" already exists when running migrate twice
exodusjs creates the migrations table on first run; subsequent runs expect it
fix
If you manually dropped the table, re-run 'exodus migrate' to recreate it. Or check if migrations have already been applied.
Upgrade
Version history
2.1.1latest on npm
Audit
Dependencies
pgrequiredPostgreSQL client used to run migrations directly via node-postgres
Agent activity
9 hits · last 30 days
node
8
Resources
exodusjs — npm install exodusjs · libregistry