Registry / database / nomadic

nomadic

JSON →
library0.2.7jsnpmunverified

A simple PostgreSQL migration tool for CLI and library use. Current stable version is 0.2.7, with irregular releases. It supports up/down migrations, hooks, prehooks, and SQL transforms. Differentiators: minimal configuration, supports JavaScript migrations alongside SQL files, and works both as a CLI and a programmatic library. Peers depend on pg (>=7 <9). Ships TypeScript types.

npm install nomadic
INSTALL
IMPORT
SIG · NOMADIC
N
nomadic
databasejavascriptv0.2.7
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.

up
import { up } from 'nomadic'
const up = require('nomadic').up;
Correct ESM import. CommonJS require is not recommended for TypeScript.
Nomadic
import { Nomadic } from 'nomadic/lib/nomadic'
import { Nomadic } from 'nomadic'
The Nomadic class is not exported from the main entry point; must import from 'nomadic/lib/nomadic'.
migrate
import { migrate } from 'nomadic'
const migrate = require('nomadic').migrate;
migrate is a named export from the main module. CommonJS users should use destructuring.

Configuration and basic CLI usage for up/down migrations.

// nomadic.config.js (CommonJS) module.exports = { host: process.env.PGHOST || 'localhost', database: process.env.PGDATABASE || 'nomadic', migrations: 'migrations', migrationsTable: 'migrations', port: parseInt(process.env.PGPORT || '5432', 10), user: process.env.PGUSER || 'postgres', password: process.env.PGPASSWORD || '' }; // Run CLI commands: // yarn nomadic create hello-world // yarn nomadic up // yarn nomadic down
Debug
Known issues
gotchaThe migrationsTable must be on the "public" schema. Non-public schemas are not supported.
fix
Ensure your migrations table is in the public schema, or set 'schema' option if available (current docs indicate public only).
affects: >=0.0.0
gotchanomadic.config.js values overwrite CLI argument values.
fix
Be aware that config file takes precedence over CLI flags; use environment variables for sensitive data.
affects: >=0.1.0
deprecatedThe `create` function signature may change in future versions.
fix
Check changelog before upgrading; library API is still evolving.
affects: >=0.2.0
gotchaPeer dependency pg must be installed separately. Error: "Cannot find module 'pg'"
fix
Run `yarn add pg` or `npm install pg` in your project.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'pg'
Missing peer dependency 'pg'
fix
npm install pg (version >=7 <9)
TypeError: (0 , nomadic.up) is not a function
Incorrect import (CommonJS require instead of destructured import)
fix
Use `const { up } = require('nomadic');` or `import { up } from 'nomadic';`
Error: connect ECONNREFUSED 127.0.0.1:5432
PostgreSQL not running or wrong connection configuration
fix
Ensure PostgreSQL server is running and connection parameters in nomadic.config.js are correct.
Error: relation "migrations" does not exist
Migrations table not created automatically on first run?
fix
Run `yarn nomadic up` to create the migrations table; it should be created automatically.
Upgrade
Version history
0.2.7latest on npm
Audit
Dependencies
pgrequiredPostgreSQL client for database connections
Agent activity
7 hits · last 30 days
node
6
Resources
nomadic — npm install nomadic · libregistry