Mermerd
Create Mermaid-Js ERD diagrams from existing tables.
Features
- Supports PostgreSQL and MySQL
- Select from available schemas
- Select only the tables you are interested in
- Show only the constraints that you are interested in
- interactive cli (multiselect, search for tables and schemas, etc.)
Why would I need it / Why should I care?
Documenting stuff and keeping it updated is hard and tedious, but having the right documentation can help to make the right decisions. Mermerd was designed to be able to export an existing database schema in a format that can be used to prototype and plan new features based on the existing schema. The resulting output is an ERD diagram in Mermaid-Js format that can easily be updated and extended.
How does it work
- Specify the connection string (via parameter or interactive cli)
- Specify the schema that should be used (via parameter or interactive cli)
- Select the tables that you are interested in (multiselect, at least 1)
- Enjoy you current database schema in Mermaid-JS format
example.mp4
Parameters
Some configurations can be set via command line parameters. The parameters can also be viewed via mermerd -h
Parameter | Description | Example |
---|---|---|
c | the connection string | mermerd -c="postgresql://user:password@localhost:5432/dvdrental" |
s | the schema | mermerd -s=public |
ac | toggle if all constraints should be included (default false) 1 | mermerd -ac |
Connection strings
Examples for connection strings:
postgresql://user:password@localhost:5432/yourDb
mysql://root:password@tcp(127.0.0.1:3306)/yourDb
How can I write/update Mermaid-JS diagrams?
- All information can be found here: Mermaid-JS
- I also recommend using an IDE with an Mermaid-JS extension, e.g. VS Code
Roadmap
- Unit tests
- Configurable suggestions for connection string input
- Support
}o--o|
relation (currently displayed as}o--||
) - Improve output file naming
Footnotes
-
If the flag
-ac
is provided, mermerd will print out all constraints of the selected tables, even when the resulting constraint is not in the list of selected tables. These tables do not have any column infos and are only present via their table name.↩