ymldot
Description
Can describe ERD in a form of ".yml".
ERD method use IDEF1X.
".yml" file to ".dot" file. ".dot" is a language used in "graphviz".
Installation
(1) if not install graphviz, type following.
-
$ apt-get install graphviz
(2) get ymldot.
-
$ gem install ymldot
Option
please see ymldot –help
Yml format
-
config
-
font
-
Please set the font name that You want to use.
-
-
size
-
Please set the image size(cm).
-
x, y
-
-
lang
-
en - english(default)
-
ja - japanese
-
-
-
tables
-
name
-
table name
-
-
columns
-
enumerate column names
-
-
foreginkeys
-
has_many
-
has_one
-
has_many_and_belongs_to
-
same meaning the relation of ActiveRecord.
-
enumerate ref table name.
-
-
polymorphic
-
name
-
type
-
tables
-
target table name.
-
-
-
-
-
category
* label * category name set. and set frame. * table * nested table.
Sample
-
in file. “sample/sample.yml”
config:
font: MSUIGOTHIC.ttf size: x: 13 y: 8
tables:
- name: customer columns: - name - phone_number foreignkeys: has_many: - order - name: order columns: - order_num - name: product columns: - name - amount - tax - product_div foreignkeys: has_many: - order - name: category columns: - name foreignkeys: has_many: - product
-
output dot file. “sample/sample.dot”
digraph sample
graph[overlap=false, splines=true] "category" [shape=record, label="{category|name\l"] "customer" [shape=record, label="customer|name\lphone_number\l"] "order" [shape=record, label="order|customerID(FK)\lproductID(FK)\lorder_num\l"] "product" [shape=record, label="product|categoryID(FK)\lname\lamount\ltax\lproduct_div\l"] "category" -> "product" [arrowtail=none arrowhead=dot headlabel="n" taillabel="1"] "customer" -> "order" [arrowtail=none arrowhead=dot headlabel="n" taillabel="1"] "product" -> "order" [arrowtail=none arrowhead=dot headlabel="n" taillabel="1"]
}
-
please type
$ dot -Tpng sample.dot -o sample.png
Copyright
- Author
-
nari <[email protected]>
- Copyright
-
Copyright © 2008 nari
- License
-
Ruby’s
Link
-
((<ymldot-project|URL:rubyforge.org/projects/ymldot>))