{"id":18464,"library":"knex-db-manager-continued","title":"knex-db-manager-continued","description":"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.","status":"active","version":"0.7.1","language":"javascript","source_language":"en","source_url":"https://github.com/Vincit/knex-db-manager","tags":["javascript","knex","sql","admin","management","postgresql","mysql"],"install":[{"cmd":"npm install knex-db-manager-continued","lang":"bash","label":"npm"},{"cmd":"yarn add knex-db-manager-continued","lang":"bash","label":"yarn"},{"cmd":"pnpm add knex-db-manager-continued","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency - core query builder library","package":"knex","optional":false},{"reason":"Required for PostgreSQL support, but only if using pg driver","package":"pg","optional":true},{"reason":"Required for PostgreSQL support to safely escape SQL","package":"pg-escape","optional":true}],"imports":[{"note":"Export is named, not default. CommonJS require works but needs .databaseManagerFactory property access. ESM import is preferred.","wrong":"const dbManager = require('knex-db-manager-continued').databaseManagerFactory;","symbol":"databaseManagerFactory","correct":"import { databaseManagerFactory } from 'knex-db-manager-continued'"},{"note":"KnexDbManager is a named class export. Default import will not work.","wrong":"import KnexDbManager from 'knex-db-manager-continued'","symbol":"KnexDbManager","correct":"import { KnexDbManager } from 'knex-db-manager-continued'"},{"note":"The package has no default export; this is a conceptual example of a mistake. Actually there is no default export.","wrong":"const { default } = require('knex-db-manager-continued')","symbol":"default","correct":"import dbManagerAdmin from 'knex-db-manager-continued'"}],"quickstart":{"code":"const config = {\n  knex: {\n    client: 'postgres',\n    connection: {\n      host: 'localhost',\n      database: 'appdb',\n      user: 'dbowner',\n      password: 'pass',\n    },\n    pool: { min: 0, max: 10 },\n    migrations: { directory: './migrations' },\n  },\n  dbManager: {\n    collate: ['fi_FI.UTF-8', 'Finnish_Finland.1252'],\n    superUser: 'superuser',\n    superPassword: 'superpass',\n    populatePathPattern: 'data/**/*.js',\n  },\n};\nconst { databaseManagerFactory } = require('knex-db-manager-continued');\nconst dbManager = databaseManagerFactory(config);\ndbManager.createDbOwnerIfNotExist().then(() => {\n  console.log('User created');\n  return dbManager.createDb('testdb');\n}).then(() => console.log('Database created')).catch(err => console.error(err));","lang":"javascript","description":"Shows how to configure and use databaseManagerFactory to create a user and database."},"warnings":[{"fix":"Ensure your knex connection user is a superuser or provide separate superuser credentials in dbManager config.","message":"Requires superuser credentials (superUser, superPassword) for admin operations; using limited user will cause permission errors.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Change const dbManager = require('knex-db-manager-continued') to const { databaseManagerFactory } = require('knex-db-manager-continued'); const dbManager = databaseManagerFactory(config);","message":"Default export removed in this fork; use named export databaseManagerFactory instead.","severity":"breaking","affected_versions":">=0.6.0"},{"fix":"Avoid calling copyDb for MySQL databases. Use pg_dump or other MySQL-specific tools for copying.","message":"On MySQL, copyDb method throws 'Not supported' error.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Temporarily disable foreign key checks before calling truncateDb, or use DELETE with cascade manually.","message":"truncateDb may fail if foreign key constraints exist; requires disabling triggers or cascade option which is not built-in.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"For MySQL, omit collate option or set to empty array.","message":"collate config option only works with PostgreSQL; on MySQL it is ignored.","severity":"deprecated","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install knex-db-manager-continued: npm install knex-db-manager-continued","cause":"Misspelled package name (original vs continued).","error":"Error: Cannot find module 'knex-db-manager'"},{"fix":"Use require() correctly; no fix needed if using CJS. For ESM, use import syntax.","cause":"Using require on a package that is ESM-only. This package is CJS, but users sometimes mistake for ESM.","error":"ERR_REQUIRE_ESM: require() of ES Module"},{"fix":"Use const { databaseManagerFactory } = require('knex-db-manager-continued');","cause":"Importing default instead of named export.","error":"TypeError: databaseManagerFactory is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}