Registry / devops / pg-to-dbml

pg-to-dbml

JSON →
library1.0.0jsnpmunverified

CLI tool that scans a PostgreSQL database and outputs DBML (Database Markup Language) files. Current stable version is 1.0.0, with unknown release cadence. Key differentiator: automates DBML generation directly from a live Postgres database connection, supporting schema/table filtering and separate file output. Requires Node.js >=16.10.0.

npm install pg-to-dbml
INSTALL
IMPORT
SIG · PG-TO-DBML
P
pg-to-dbml
devopsjavascriptv1.0.0
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.

cli
npx pg-to-dbml --c=postgresql://user:pass@host:5432/db --db=mydb
pg-to-dbml --connection_string=...
The tool is a CLI, not a library. Use npx or global install.
programmatic API
import { run } from 'pg-to-dbml'
const pgToDbml = require('pg-to-dbml')
Package exports a single run function; ESM only.

Connects to a Postgres database and outputs DBML files for all tables in the public schema.

npx pg-to-dbml --c=postgresql://user:pass@localhost:5432/mydb --db=mydb -o=./dbml --exclude_schemas=information_schema
Debug
Known issues
breakingNode.js 16.10.0 or higher required, lower versions cause cryptic errors.
fix
Update Node.js to >=16.10.0 or use an older version of the package.
affects: <1.0.0
gotchaConnection string is required but can be provided via environment variable DATABASE_URL or --c flag.
fix
Ensure DATABASE_URL is set or pass -c argument.
affects: >=1.0.0
gotchaThe --db_name (--db) option is required, even if connection string includes database name.
fix
Always specify --db flag with the database name.
affects: >=1.0.0
Errors
Common errors & fixes
error: password authentication failed for user "postgres"
Incorrect password or missing pg_hba.conf permission.
fix
Verify credentials and check PostgreSQL pg_hba.conf settings.
Error: Cannot find module 'pg'
Dependency missing, likely due to incomplete install.
fix
Run npm install in the project directory.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
pgrequiredPostgreSQL client for database connection
yargsrequiredCommand-line argument parsing
Agent activity
2 hits · last 30 days
node
2
Resources
pg-to-dbml — npm install pg-to-dbml · libregistry