-
Notifications
You must be signed in to change notification settings - Fork 170
/
table.dot.tmpl
32 lines (30 loc) · 2.45 KB
/
table.dot.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{{- $sc := .showComment -}}
{{- $sd := .showDef -}}
digraph "{{ .Table.Name }}" {
// Config
graph [rankdir=TB, layout=dot, fontname="Arial"];
node [shape=record, fontsize=14, margin=0.6, fontname="Arial"];
edge [fontsize=10, labelfloat=false, splines=none, fontname="Arial"];
// Tables
"{{ .Table.Name }}" [shape=none, label=<<table border="3" cellborder="1" cellspacing="0" cellpadding="6">
<tr><td bgcolor="#EFEFEF"><font face="Arial Bold" point-size="18">{{ .Table.Name | html }}</font> <font color="#666666">[{{ .Table.Type | html }}]</font>{{ if $sc }}{{ if ne .Table.Comment "" }}<br /><font color="#333333">{{ .Table.Comment | html | nl2br_slash }}</font>{{ end }}{{ end }}</td></tr>
{{- range $ii, $c := .Table.Columns }}
{{- if $c.HideForER }}{{ continue }}{{ end }}
<tr><td port="{{ $c.Name | html }}" align="left">{{ $c.Name | html }} <font color="#666666">[{{ $c.Type | html }}]</font>{{ if $sc }}{{ if ne $c.Comment "" }} {{ $c.Comment | html | nl2space }}{{ end }}{{ end }}</td></tr>
{{- end }}
</table>>];
{{- range $i, $t := .Tables }}
"{{ $t.Name }}" [shape=none, label=<<table border="0" cellborder="1" cellspacing="0" cellpadding="6">
<tr><td bgcolor="#EFEFEF"><font face="Arial Bold" point-size="18">{{ $t.Name | html }}</font> <font color="#666666">[{{ $t.Type | html }}]</font>{{ if $sc }}{{ if ne $t.Comment "" }}<br /><font color="#333333">{{ $t.Comment | html | nl2br_slash }}</font>{{ end }}{{ end }}</td></tr>
{{- range $ii, $c := $t.Columns }}
{{- if $c.HideForER }}{{ continue }}{{ end }}
<tr><td port="{{ $c.Name | html }}" align="left">{{ $c.Name | html }} <font color="#666666">[{{ $c.Type | html }}]</font>{{ if $sc }}{{ if ne $c.Comment "" }} {{ $c.Comment | html | nl2space }}{{ end }}{{ end }}</td></tr>
{{- end }}
</table>>];
{{- end }}
// Relations
{{- range $i, $r := .Relations }}
{{- if $r.HideForER }}{{ continue }}{{ end }}
"{{ $r.Table.Name }}":{{ $c := index $r.Columns 0 }}"{{ $c.Name }}" -> "{{ $r.ParentTable.Name }}":{{ $pc := index $r.ParentColumns 0 }}"{{ $pc.Name }}" [dir=back, arrowtail=crow, {{ if $r.Virtual }}style ="dashed",{{ end }} taillabel=<<table cellpadding="5" border="0" cellborder="0"><tr><td>{{ if $sd }}{{ $r.Def | html }}{{ end }}</td></tr></table>>];
{{- end }}
}