Registry / database / migrami

migrami

JSON →
library0.6.5jsnpmunverified

Naïve PostgreSQL migrations library for Node.js (v0.6.5, alpha). Focuses on fast iteration with SQL-only forward migrations, a watcher mode, and transaction safety. Inspired by Graphile Migrate but simpler: no down migrations, no ORM integration. Only supports Postgres and forward-only idempotent SQL. Release cadence is irregular. Distinguishes itself by prioritizing a native SQL workflow and instant feedback via file watcher.

npm install migrami
INSTALL
IMPORT
SIG · MIGRAMI
M
migrami
databasejavascriptv0.6.5
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.

migrami
import migrami from 'migrami'
const migrami = require('migrami')
Package is ESM-only since v0.5.0; CommonJS require will not work
default export (function)
import migrami from 'migrami'
import { migrami } from 'migrami'
Named export does not exist; default export is a function
migrami types (if using TypeScript)
import type { MigramiConfig } from 'migrami'
import { MigramiConfig } from 'migrami'
Type-only imports exist for configuration, but runtime export is a default function

Shows how to initialize migrami with connection string and run the migrate command programmatically.

// quickstart.js import migrami from 'migrami'; const { exec } = migrami({ connectionString: process.env.DATABASE_URL ?? 'postgresql://localhost:5432/mydb', migrationsPath: './migrations/committed', currentPath: './migrations/current.sql', schema: 'public', table: 'migrations', }); async function main() { // Apply all pending committed migrations await exec('migrate'); console.log('Migrations applied'); } main().catch(err => console.error(err));
Debug
Known issues
gotchaPackage is alpha and experimental; not recommended for production use without careful testing.
fix
Test thoroughly or consider alternative migration tools like node-pg-migrate or graphile-migrate.
affects: >=0.1.0
breakingv0.5.0 switched to ESM-only exports; CommonJS require() will fail.
fix
Use import syntax or upgrade to a newer version that supports both (currently ESM-only).
affects: >=0.5.0
gotchaOnly forward migrations supported; no down migration generation. Idempotent SQL is expected.
fix
Write idempotent SQL (e.g., IF NOT EXISTS) to allow re-running.
affects: >=0.1.0
deprecatedThe 'down' command removes the last migration from the migrations table but does not revert the schema changes.
fix
Use 'down' only for metadata removal; manually revert SQL if needed.
affects: >=0.1.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Node.js is not configured for ESM, or the project is using CommonJS.
fix
Add "type": "module" to package.json or rename file to .mjs.
Error: Cannot find module 'migrami'
Package not installed or wrong import path.
fix
Run npm install migrami and ensure import path is 'migrami'.
TypeError: migrami is not a function
Attempting named import instead of default.
fix
Use import migrami from 'migrami'.
Upgrade
Version history
0.6.5latest on npm
Audit
Dependencies
pgrequiredPostgreSQL client used to connect and execute SQL
Agent activity
4 hits · last 30 days
node
4
Resources
migrami — npm install migrami · libregistry