为 postgres 数据库架构生成 DOT 描述
dbdot is a command line tool that generates DOT description from postgres database schema.
dbdot is compiled to platform specific binary, so all you need is the right binary for your machine. Grab the appropriate binary for your architecture from the latest release here.
pgguide and user kewluser$ ./dbdot -dbname=pgguide -user=kewluser [16:33:31]
digraph {
node[label=,shape=plaintext] n1;
node[label=,shape=plaintext] n2;
node[label=,shape=plaintext] n3;
node[label=,shape=plaintext] n4;
n2->n1;
n2->n4;
n4->n3;
}pgguide db for kewluser$ ./dbdot -dbname=pgguide -user=kewluser > test.dot && dot -Tpng test.dot -o outfile.png && open outfile.pngAbove command pipes the DOT description into test.dot and invokes dot cli tool to transform test.dot to a outfile.png. Here's what outfile.png looks like:
./dbdot -dbname=pgguide -user=kewluser > test.dot --whitelist=purchase_items,purchases && dot -Tpng test.dot -o outfile-whitelisted.png && open outfile-whitelisted.pngHere's what outfile-whitelisted.png looks like:
dbdot currently supports the following flags:
-W ask for password
-dbname string
dbname for which you want to generate dot file
-host string
database host (default "localhost")
-port uint
database port (default 5432)
-schema string
schema name (default "public")
-sslmode
enable sslmode for postgres db connection
-user string
username of postgres db
-whitelist string
comma separated list of tables you want to generate dot file forHere's some features I would like to have for this project:
A while back I wanted a simple tool that would just spit out schema for tables that I wanted. A lot of tools I found were way too powerful, requiring a zillion installation and configuration. This inspired me to write a simple self contained tool that was laser focused on just reading schema and spitting out DOT.
暂无开放 Issues,或尚未同步最近议题。