Registry / database / knex-db-manager-continued

knex-db-manager-continued

JSON →
library0.7.1jsnpmunverified

A database management utility for knex that provides administrative operations like creating/dropping databases and users, truncating tables, and copying databases. Version 0.7.1 supports PostgreSQL, MySQL, and SQLite3, and is compatible with knex 0.x, 1.x, and 2.x. It is a maintained fork of the original knex-db-manager, updated to work with newer knex versions. Key differentiators: uses superuser credentials for privileged operations, supports collation and seed patterns, and includes truncate with ignore tables. Release cadence: sporadic.

npm install knex-db-manager-continued
INSTALL
IMPORT
SIG · KNEX-DB-MANAGER-CO
K
knex-db-manager-continued
databasejavascriptv0.7.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

databaseManagerFactory
import { databaseManagerFactory } from 'knex-db-manager-continued'
const dbManager = require('knex-db-manager-continued').databaseManagerFactory;
Export is named, not default. CommonJS require works but needs .databaseManagerFactory property access. ESM import is preferred.
KnexDbManager
import { KnexDbManager } from 'knex-db-manager-continued'
import KnexDbManager from 'knex-db-manager-continued'
KnexDbManager is a named class export. Default import will not work.
default
import dbManagerAdmin from 'knex-db-manager-continued'
const { default } = require('knex-db-manager-continued')
The package has no default export; this is a conceptual example of a mistake. Actually there is no default export.

Shows how to configure and use databaseManagerFactory to create a user and database.

const config = { knex: { client: 'postgres', connection: { host: 'localhost', database: 'appdb', user: 'dbowner', password: 'pass', }, pool: { min: 0, max: 10 }, migrations: { directory: './migrations' }, }, dbManager: { collate: ['fi_FI.UTF-8', 'Finnish_Finland.1252'], superUser: 'superuser', superPassword: 'superpass', populatePathPattern: 'data/**/*.js', }, }; const { databaseManagerFactory } = require('knex-db-manager-continued'); const dbManager = databaseManagerFactory(config); dbManager.createDbOwnerIfNotExist().then(() => { console.log('User created'); return dbManager.createDb('testdb'); }).then(() => console.log('Database created')).catch(err => console.error(err));
knex-db-manager --version
Debug
Known issues
gotchaRequires superuser credentials (superUser, superPassword) for admin operations; using limited user will cause permission errors.
fix
Ensure your knex connection user is a superuser or provide separate superuser credentials in dbManager config.
affects: >=0.1.0
breakingDefault export removed in this fork; use named export databaseManagerFactory instead.
fix
Change const dbManager = require('knex-db-manager-continued') to const { databaseManagerFactory } = require('knex-db-manager-continued'); const dbManager = databaseManagerFactory(config);
affects: >=0.6.0
gotchaOn MySQL, copyDb method throws 'Not supported' error.
fix
Avoid calling copyDb for MySQL databases. Use pg_dump or other MySQL-specific tools for copying.
affects: >=0.1.0
gotchatruncateDb may fail if foreign key constraints exist; requires disabling triggers or cascade option which is not built-in.
fix
Temporarily disable foreign key checks before calling truncateDb, or use DELETE with cascade manually.
affects: >=0.1.0
deprecatedcollate config option only works with PostgreSQL; on MySQL it is ignored.
fix
For MySQL, omit collate option or set to empty array.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'knex-db-manager'
Misspelled package name (original vs continued).
fix
Install knex-db-manager-continued: npm install knex-db-manager-continued
ERR_REQUIRE_ESM: require() of ES Module
Using require on a package that is ESM-only. This package is CJS, but users sometimes mistake for ESM.
fix
Use require() correctly; no fix needed if using CJS. For ESM, use import syntax.
TypeError: databaseManagerFactory is not a function
Importing default instead of named export.
fix
Use const { databaseManagerFactory } = require('knex-db-manager-continued');
Upgrade
Version history
0.7.1latest on npm
Audit
Dependencies
knexrequiredPeer dependency - core query builder library
pgoptionalRequired for PostgreSQL support, but only if using pg driver
pg-escapeoptionalRequired for PostgreSQL support to safely escape SQL
Agent activity
2 hits · last 30 days
node
2
Resources
knex-db-manager-continued — npm install knex-db-manager-continued · libregistry