Registry / database / ddl-manager

ddl-manager

JSON →
library2.4.32-alphajsnpmunverified

ddl-manager (v2.4.32-alpha) is a CLI tool for storing PostgreSQL functions and triggers in files and synchronizing them with a database. It supports building (migrating from files to DB), watching for file changes, and dumping (exporting DB objects to files). Unlike general migration tools, it focuses specifically on managing procedural objects and offers a configuration file for database connection and parsing options. Note: version includes '-alpha', indicating it is still in development.

npm install ddl-manager
INSTALL
IMPORT
SIG · DDL-MANAGER
D
ddl-manager
databasejavascriptv2.4.32-alpha
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.

default
import { build, dump, watch } from 'ddl-manager'
import ddlManager from 'ddl-manager'
Provides named exports for programmatic use; no default export.
build
import { build } from 'ddl-manager'
const { build } = require('ddl-manager')
ESM-only package; use import syntax in Node >= 12.
watch
import { watch } from 'ddl-manager'
require('ddl-manager').watch
CLI command also available via 'ddl-manager watch'.

Programmatic example of using build() to migrate SQL files to PostgreSQL.

import { build } from 'ddl-manager' const config = { host: process.env.PGHOST ?? 'localhost', port: parseInt(process.env.PGPORT ?? '5432'), database: process.env.PGDATABASE ?? 'mydb', user: process.env.PGUSER ?? 'postgres', password: process.env.PGPASSWORD ?? '', folder: './ddl' } build(config) .then(() => console.log('Build complete')) .catch(console.error)
Debug
Known issues
breakingv2.0.0 switched from CJS to ESM. require() calls will fail.
fix
Use import syntax or dynamic import() instead of require().
affects: >=2.0.0
deprecatedThe --user flag is deprecated in favor of PGUSER environment variable. It may be removed in a future version.
fix
Set PGUSER environment variable instead of using --user.
affects: >=2.3.0
gotchaBuild command by default overwrites existing procedures/triggers in database. Runs with --force flag implicitly.
fix
Use dump with --unfreeze=true to get a snapshot before building.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'ddl-manager'
Package is ESM-only; require() does not work.
fix
Use import statement or enable ESM in your project (e.g., add 'type': 'module' in package.json).
SyntaxError: Unexpected token 'export'
Using require() to load an ESM module.
fix
Switch to import syntax or use dynamic import().
TypeError: build is not a function
Importing default export instead of named export.
fix
Change import to: import { build } from 'ddl-manager'
Connection refused: localhost:5432
PostgreSQL not running or wrong connection parameters.
fix
Ensure PostgreSQL is running and check config (host, port, user, password).
The --user flag is deprecated. Please use the PGUSER environment variable instead.
Using deprecated --user flag.
fix
Remove --user flag and set PGUSER environment variable.
Upgrade
Version history
2.4.32-alphalatest on npm
Audit
Dependencies
postgresrequiredRuntime peer dependency for database connection (pino-based logger)
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources