sql_mermaid_visualizer

Crates.iosql_mermaid_visualizer
lib.rssql_mermaid_visualizer
version0.1.0
sourcesrc
created_at2022-02-05 00:34:33.670244
updated_at2022-02-05 00:34:33.670244
descriptionA very simple tool written in Rust that takes PostgreSQL database files and generates a [Mermaid](https://mermaid-js.github.io/mermaid) entity relationship diagram.
homepage
repositoryhttps://github.com/CoBrooks/sql_mermaid_visualizer
max_upload_size
id527191
size23,509
(CoBrooks)

documentation

README

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
Commit count: 3

cargo fmt