Skip to content

๐Ÿ˜ Mermaid diagram generator for PostgreSQL database schema

License

Notifications You must be signed in to change notification settings

bastiensun/pg-mermaid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

30 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ˜ pg-mermaid

Mermaid diagram generator for PostgreSQL database schema.

Warning

Experimental version, work in progress

Prerequisites

  • node (>=14.15.0 LTS)
  • npm (>=5.2.0)

Usage

npx pg-mermaid --help
Usage: pg-mermaid [options]

Options:
  -d, --dbname <dbname>          database name to connect to
  -U, --username <username>      username to connect to the database
  -h, --host <hostname>          host address of the database (default: "127.0.0.1")
  -p, --port <port>              port number at which the instance is listening (default: "5432")
  --schema <schema>              schema name to generate to (default: "public")
  --output-path <outputPath>     output path to generate to (default: "./database.md")
  --excluded-tables <tables...>  tables to exclude
  --help                         display help for command

Environment variables:
  PGPASSWORD                     password to be used if the server demands password authentication

Example call

 PGPASSWORD=<password> npx pg-mermaid --dbname <dbname> --username <username>

Example result

cf. examples/database.md

Development

This project was generated with Nx.

Prerequisites

  • pnpm (>=6.0.0)

Install dependencies

pnpm install

Run pg-mermaid executable

Build to convert TypeScript script in JavaScript then run script with node

nx build cli
node dist/packages/cli/src/index.js

Or run TypeScript script directly with tsx

tsx packages/cli/src/index.ts

Run tests

nx test cli