1 unstable release
0.1.0 | Feb 5, 2022 |
---|
#8 in #relationship
9KB
172 lines
SQL Database Mermaid Visualizer
A very simple tool written in Rust that takes PostgreSQL database files and generates a Mermaid entity relationship diagram.
Installation
This project is published to crates.io and thus can be installed using
$ cargo install sql_mermaid_visualizer
If you do not have cargo, the installation steps can be found here
Usage
USAGE:
sqlvis [OPTIONS] --file <FILE>
OPTIONS:
-f, --file <FILE>
-h, --help Print help information
-o, --output-file <OUTPUT_FILE>
-V, --version Print version information
Example
To print the Mermaid representation of the ./examples/simple.sql example
to stdout
:
$ sqlvis -f ./examples/simple.sql
Sample output of the above command:
erDiagram
Student {
INT StudentId
INT ParentId
VARCHAR30 Name
INT Age
VARCHAR25 Address
VARCHAR20 Phone
}
Parent {
INT ParentId
INT StudentId
INT PartnerId
VARCHAR30 Name
VARCHAR25 Address
VARCHAR20 Phone
}
Student ||--|{ Parent : "FK_StudentParentId"
Parent ||--|{ Student : "FK_ParentStudentId"
Parent ||--|{ Parent : "FK_ParentPartnerId"
To output the Mermaid representation of the ./examples/big.sql example
into ./big.md
:
$ sqlvis -f ./examples/big.sql -o ./big.md
Dependencies
~3MB
~61K SLoC