From 7663825a304581da53494787072fa816145db548 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Sun, 16 Oct 2022 18:50:32 +0200 Subject: [PATCH] add postgresql_autodoc --- .aliases | 29 ++++++++++++++++++++++++++++- README.md | 11 +++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/.aliases b/.aliases index 6fe8c0e5..ae9ceaf0 100644 --- a/.aliases +++ b/.aliases @@ -1,7 +1,7 @@ gradleWrapper () { if [ ! -f gradlew ]; then echo "No 'gradlew' found. Maybe you are not in the root dir of a gradle project?" - exit 1 + return 1 fi TEMPFILE=$(mktemp /tmp/gw.XXXXXX) @@ -12,6 +12,33 @@ gradleWrapper () { rm $TEMPFILE } +postgresAutodoc () { + if ! [ -x "$(command -v postgresql_autodoc)" ]; then + echo "Program 'postgresql_autodoc' not found. Please install, e.g. via: sudo apt install postgresql-autodoc" >&2 + echo "See also https://github.com/cbbrowne/autodoc" >&2 + return 1 + fi + + if ! [ -x "$(command -v dot)" ]; then + echo "Program 'graphviz dot' not found. Please install, e.g. via: sudo apt install graphviz" >&2 + echo "See also https://graphviz.org" >&2 + return 1 + fi + postgresql_autodoc -d postgres -f build/postgres-autodoc -h localhost -u postgres --password=password \ + -m '(rbacobject|hs).*' \ + -l /usr/share/postgresql-autodoc -t neato && + dot -Tsvg build/postgres-autodoc.neato >build/postgres-autodoc-hs.svg && \ + echo "generated: $PWD/build/postgres-autodoc-hs.svg" + + postgresql_autodoc -d postgres -f build/postgres-autodoc -h localhost -u postgres --password=password \ + -m '(global|rbac).*' \ + -l /usr/share/postgresql-autodoc -t neato && + dot -Tsvg build/postgres-autodoc.neato >build/postgres-autodoc-rbac.svg && \ + echo "generated $PWD/build/postgres-autodoc-rbac.svg" +} + +alias postgres-autodoc=postgresAutodoc + alias podman-start='systemctl --user enable --now podman.socket && systemctl --user status podman.socket && ls -la /run/user/$UID/podman/podman.sock' alias podman-stop='systemctl --user disable --now podman.socket && systemctl --user status podman.socket && ls -la /run/user/$UID/podman/podman.sock' alias podman-use='export DOCKER_HOST="unix:///run/user/$UID/podman/podman.sock"; export TESTCONTAINERS_RYUK_DISABLED=true' diff --git a/README.md b/README.md index e1a27f73..c5d42e59 100644 --- a/README.md +++ b/README.md @@ -725,6 +725,17 @@ It can also be executed directly: gw processSpring ``` +### How to Generate Database Table Diagrams? + +Some overview documentation about the database can be generated via [postgresql_autodoc](https://github.com/cbbrowne/autodoc"). +To make it easier, the command line is included in the `.aliases`, just call: + +```shell +postgres-autodoc +``` + +The output will list the generated files. + ## Further Documentation