pg-mermaid is an open-source command-line interface (CLI) tool designed to generate Entity-Relationship Diagram (ERD) definitions in Mermaid syntax directly from a PostgreSQL database schema. Currently at version 0.2.1, it is explicitly marked as experimental and a work in progress, indicating an early stage of development with potential for frequent, unannounced changes and incomplete features. Its primary function is to simplify the visualization of database structures for documentation and communication, leveraging the human-readable Mermaid markdown language. Unlike general-purpose schema introspection tools, pg-mermaid focuses specifically on PostgreSQL and outputs a format readily renderable by Mermaid-compatible viewers and platforms. Given its early version, a stable release cadence is not yet established, and users should anticipate ongoing development rather than fixed schedules.
npm install pg-mermaidNo compatibility data collected yet for this library.
Generates a Mermaid ERD markdown file for a PostgreSQL database, excluding specified tables.
Monitor GitHub releases for changes. Consider pinning to exact versions in production environments or using a version range with caution.
Use a robust secrets management system. Avoid hardcoding passwords. Ensure shell history is not saving sensitive commands. For automated scripts, consider temporary environment variable settings or specific CI/CD secret handling.
Install `pg-mermaid` globally (`npm install -g pg-mermaid`) or locally (`npm install pg-mermaid`) and then use `pg-mermaid ...` or `npx pg-mermaid ...` respectively to avoid repeated downloads and ensure a specific version.
Review the generated Mermaid Markdown carefully for any missing or incorrectly represented schema elements. Manual adjustments to the Markdown output may be necessary for complex database designs. Provide feedback to the project maintainers for feature requests.
Ensure your PostgreSQL server is running. Verify the `--host` and `--port` options are correct. Check firewall rules and network connectivity between where `pg-mermaid` is run and the database server.
Double-check the `--username` parameter and the `PGPASSWORD` environment variable. Ensure the user exists and has the correct password set in PostgreSQL. Also check if the user has permissions to connect from the specified host.
Verify the `--dbname` parameter matches an existing database on your PostgreSQL instance. Check for typos or case sensitivity in the database name.