diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/graphviz-sql.sh | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/scripts/graphviz-sql.sh b/scripts/graphviz-sql.sh index 5690bbfc..76901076 100644 --- a/scripts/graphviz-sql.sh +++ b/scripts/graphviz-sql.sh @@ -25,20 +25,16 @@ # # On FreeBSD, SQL Fairy is /usr/ports/databases/p5-SQL-Translator. -for i in "$@" -do - sqlt-graph --db MySQL --output-type canon --show-datatypes --show-constraints $i | - perl -0777 -pe ' - s/\\\n//g; - s/ +/ /g; - s/\\\|/|/g; - s/\\{([a-z0-9_]+)\|/${1}|{/gi; - s/-\\ +//g; - s/\\ \\l/|/g; - s/\|\\l \\}/}/g; - s/\|\\}/}/g; - s/{\n/{\n\tedge [arrowtail=none, arrowhead=crow];\n/; - ' | - dot -Tps2 | - ps2pdf - ${i%.sql}.pdf -done +sqlt-graph --db MySQL --output-type canon --show-datatypes --show-constraints $1 | +SOURCE="$1" perl -0777 -pe ' + s/\\\n//g; + s/ +/ /g; + s/\\\|/|/g; + s/\\{([a-z0-9_]+)\|/${1}|{/gi; + s/-\\ +//g; + s/\\ \\l/|/g; + s/\|\\l \\}/}/g; + s/\|\\}/}/g; + s/{\n/{\n\tedge [arrowtail=none, arrowhead=crow];\n/; + s=^=// Automatically generated from $ENV{SOURCE}\n\n=; +' |