-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefault.tmpl
36 lines (30 loc) · 1.09 KB
/
default.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
@startuml
'https://raphael-leger.medium.com/automatically-generating-up-to-date-database-diagrams-with-typeorm-d1279a20545e
skinparam class {
BackgroundColor #eef4f4
}
!define primary_key(x) <b><color:#0fbebe><&key></color> x</b>
!define foreign_key(x) <color:#aaaaaa><&key></color> x
!define column(x) <color:#bdc3c7><&media-record></color> x
!define table(name, desc) class name as "desc" << (T,#aafdcf) >>
!define comment(x) <color:#1b1cbf>x</color>
!define type(x) <color:#fa5410>x</color>
hide methods
hide stereotypes
{{ range .Tables }}
table( {{ .Name }}, {{ .Name }}{{ if .Comment }}\n({{ .Comment }}) {{- end }} ) {
{{- range .Columns }}
{{- if .IsPrimaryKey }}
primary_key( {{ .Name }} ): type( {{ .Type }} ) {{ if .Comment }} comment( {{ .Comment }} ) {{ end }}
{{- else }}
column( {{ .Name }} ): type( {{ .Type }} ) {{ if .Comment }} comment( {{ .Comment }} ) {{ end }}
{{- end }}
{{- end }}
}
{{ end }}
{{ range $r := .Relationship -}}
{{- range $r.RelationTables -}}
"{{ $r.TableName }}" "id" -- "{{ .Column }}" "{{ .TableName }}"
{{ end }}
{{- end }}
@enduml