-
Notifications
You must be signed in to change notification settings - Fork 168
/
schema.dot.tmpl
43 lines (40 loc) · 2.7 KB
/
schema.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
33
34
35
36
37
38
39
40
41
42
43
{{- $sc := .showComment -}}
{{- $sd := .showDef -}}
digraph "{{ .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
{{- range $i, $g := .Groups }}
subgraph cluster_group_{{ $i }} {
label="{{ $g.Name }}";
style = "rounded,filled,setlinewidth(3),bold";
color = "{{ $g.Color }}";
fillcolor = "#FFFFFF00"
{{- range $j, $t := $g.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 }}
}
{{- end }}
{{- 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 $j, $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 }}
}