[数据库设计]使用Graphviz画ER图

 

Netkiller Developer 手札

November 15, 2008

MrNeo Chan陈景峰

 


中国广东省深圳市宝安区龙华镇
518109
+86 755 29812080
+86 755 29812080

 

版权声明

转载请与作者联系,转载时请务必标明文章原始出处和作者信息及本声明。

[数据库设计]使用Graphviz画ER图_第1张图片

 

文档出处: http://netkiller.sourceforge.net/ | http://netkiller.github.com

文档最近一次更新于 Mon Dec 5 09:39:01 UTC 2011

 

 

to see all available graphviz packages.

$ apt-cache search graphviz |grep ^g
graphviz - rich set of graph drawing tools
graphviz-dev - transitional package for graphviz-dev rename
graphviz-doc - additional documentation for graphviz

$ apt-cache search graphviz |grep Graphviz
dot2tex - Graphviz to LaTeX converter
libgraph-easy-perl - Perl module to convert or render graphs (as ASCII, HTML, SVG or via Graphviz)
python-pydot - Python interface to Graphviz's dot
python-pygraphviz - Python interface to the Graphviz graph layout and visualization package
python-yapgvb - Python bindings for Graphviz, using Boost.Python
xdot - interactive viewer for Graphviz dot files
			

 

$ sudo apt-get install graphviz
			

Test, A "Hello World" example made by giving the command:

echo "digraph G {Hello->World}" | dot -Tpng >hello.png
 
$ cat erd.gv
digraph g {
graph [
rankdir = "LR"
];
node [
fontsize = "16"
shape = "ellipse"
];
edge [
];

"user" [
        label = "User| <id> id|username|password|last|status"
        shape = "record"
];

"profile" [
        label = "Profile| <id> id | name | sex | age | address | icq | msn"
        shape = "record"
];

user:id->profile:id [label="1:1"];

"category" [
        label = "Category| <id> id | <pid> pid | name | status"
        shape = "record"
];

category:pid->category:id [label="1:n"];

"article" [
        label = "Article| <id> id| <user_id> user_id | <cid> category_id | title | content | datetime | status"
        shape = "record"
];

article:user_id->user:id [label="1:n"];
article:cid->category:id [label="1:n"];

"feedback" [
        label = "Feedback| <id> id| <user_id> user_id | <article_id> article_id | title | content | datetime | status"
        shape = "record"
];

feedback:user_id->user:id [label="1:n"];
feedback:article_id->article:id [label="1:n"];

}
			
			
			
$ dot -Tpng erd.gv > erd.png
			

[数据库设计]使用Graphviz画ER图_第2张图片
 

你可能感兴趣的:(E-R,er,Graphviz,ERD)