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.
mig
✓ import mig from 'ship-hold-migration'
✗ const mig = require('ship-hold-migration')
Default export is a function that takes a ship-hold instance.
ship-hold
✓ import sh from 'ship-hold'
✗ const sh = require('ship-hold')(options)
ship-hold is required as a dependency.
migrator
✓ const migrator = sh.migrator()
✗ const migrator = require('ship-hold-migration').migrator()
After calling mig(sh), sh.migrator() becomes available.
Initialize ship-hold, attach migration adapter, run all pending migrations, then rollback the last one.
import sh from 'ship-hold';
import mig from 'ship-hold-migration';
const db = sh({
host: 'localhost',
port: 5432,
database: 'test',
user: 'postgres',
password: process.env.DB_PASSWORD ?? ''
});
mig(db);
const migrator = db.migrator();
async function runMigrations() {
const pending = await migrator.pending();
console.log('Pending migrations:', pending);
const result = await migrator.up();
console.log('Executed migrations:', result);
await migrator.down();
console.log('Rolled back last migration');
}
runMigrations().catch(console.error);
Errors
Common errors & fixes
Cannot find module 'ship-hold-migration'
ship-hold-migration not installed or not in node_modules.
fixnpm install ship-hold-migration
TypeError: mig(...) is not a function
Importing the module incorrectly, e.g., using default import where named export expected.
fixUse import mig from 'ship-hold-migration' or const mig = require('ship-hold-migration'). sh.migrator is not a function
The mig function was not called on the ship-hold instance.
fixEnsure you call mig(sh) before accessing sh.migrator().
Audit
Dependencies
ship-holdrequiredCore ORM that this adapter extends