An open API service indexing awesome lists of open source software.

https://github.com/nextbreakpoint/schema2dot

Generate a graph in dot format from a database schema
https://github.com/nextbreakpoint/schema2dot

Last synced: about 2 months ago
JSON representation

Generate a graph in dot format from a database schema

Awesome Lists containing this project

README

        

# schema2dot (experimental)

Generate a graph file in dot format from a database schema.

## How to use

Run Postgres database using Docker:

docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=password -d postgres

Create an empty database:

docker run -it --rm -v $(pwd):/script --link some-postgres:postgres postgres psql -h postgres -U postgres -c "create database test"

Create tables and constraints from a DDL file:

docker run -it --rm -v $(pwd):/script --link some-postgres:postgres postgres psql -h postgres -U postgres -d test -f /script/ddl.sql

Create or edit the configuration file:

cat test.properties

jdbc.url=jdbc:postgresql://localhost/test
jdbc.username=postgres
jdbc.password=password

Build the schema2dot command (requires Maven):

mvn clean package

Generate the graph from the database schema:

java -jar target/com.nextbreakpoint.schema2dot-1.0.jar test.properties

Generate a PNG image from the graph (requires Graphviz):

dot -Tpng graph.dot > graph.png

Generate a SVG image from the graph (requires Graphviz):

dot -Tsvg graph.dot > graph.svg