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.
Meyer
✓ import Meyer from 'meyer'
✗ const { Meyer } = require('meyer')
Default export in ESM; CJS users must use require('meyer').default
Meyer (as a class)
✓ const { default: Meyer } = require('meyer')
✗ const Meyer = require('meyer')
CJS users need to use .default to get the class
MeyerConfig
✓ import type { MeyerConfig } from 'meyer'
✗ import { MeyerConfig } from 'meyer'
MeyerConfig is exported as a type only
Initialize Meyer with Knex DBMS, connect via DATABASE_URL env var, run migrations, and close connection.
#!/usr/bin/env node
// @ts-check
const { default: Meyer } = require('meyer');
const { default: KnexDbms } = require('meyer-dbms-knex');
const path = require('path');
const parse = require('pg-connection-string').parse;
if (!process.env.DATABASE_URL) {
console.error('No database URL provided from environment');
process.exit(1);
}
async function run() {
const options = parse(process.env.DATABASE_URL);
const options2 = {
...options,
port: Number(options.port),
ssl: Boolean(options.ssl),
};
const dbms = new KnexDbms('pg', options2);
const meyer = new Meyer({
tableName: '_migrations',
migrationsPath: path.join(__dirname, '..', 'migrations'),
development: process.env.MIGRATION_MODE === 'development',
dbms,
});
await meyer.execute();
await dbms.close();
}
run().catch((e) => {
console.error(e);
process.exit(1);
});
Debug
Known issues
breakingRequires Node.js 18.x due to engine restriction. Older versions will fail to install or run.fixUpgrade Node.js to 18.x or later.
affects: >=1.0.0
gotchaCJS require does not get default export directly. You must use require('meyer').default.fixUse const { default: Meyer } = require('meyer'); affects: >=1.0.0
gotchaMeyer does not bundle any DBMS; you must install a separate DBMS package like meyer-dbms-knex or meyer-dbms-mssql.fixRun 'yarn add meyer-dbms-knex' or 'yarn add meyer-dbms-mssql'.
affects: >=1.0.0
gotchaThe 'development' option enables automatic DOWN rollbacks if prior migrations are modified, which could cause data loss if not expected.fixSet development: false in production environments.
affects: >=1.0.0
deprecatedNo deprecation warnings reported yet. The package has infrequent releases.
Errors
Common errors & fixes
TypeError: Meyer is not a constructor
Using default import incorrectly in CJS, e.g., const Meyer = require('meyer')
fixUse const { default: Meyer } = require('meyer'); Cannot find module 'meyer-dbms-knex'
Missing required DBMS adapter package.
fixInstall meyer-dbms-knex or meyer-dbms-mssql via yarn add.
Error: knex: Required configuration option 'client' is missing.
Meyer's Knex DBMS expects a valid client name (e.g. 'pg') as first argument to KnexDbms constructor.
fixInstantiate with new KnexDbms('pg', options) or the correct client for your database. Audit
Dependencies
meyer-dbms-knexoptionalPluggable DBMS adapter needed to connect to databases via Knex
meyer-dbms-mssqloptionalAlternative DBMS adapter for MSSQL databases