diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go index 885823d16..b724c8b05 100644 --- a/d2graph/d2graph.go +++ b/d2graph/d2graph.go @@ -1084,7 +1084,9 @@ func (g *Graph) Texts() []*d2target.MText { } } else if obj.SQLTable != nil { for _, column := range obj.SQLTable.Columns { - texts = appendTextDedup(texts, column.Text()) + for _, t := range column.Texts() { + texts = appendTextDedup(texts, t) + } } } } diff --git a/d2target/sqltable.go b/d2target/sqltable.go index ad6b6f61b..0680e623e 100644 --- a/d2target/sqltable.go +++ b/d2target/sqltable.go @@ -1,11 +1,5 @@ package d2target -import ( - "fmt" - - "oss.terrastruct.com/d2/d2renderers/d2fonts" -) - const ( NamePadding = 10 TypePadding = 20 @@ -22,13 +16,22 @@ type SQLColumn struct { Reference string `json:"reference"` } -func (c SQLColumn) Text() *MText { - return &MText{ - Text: fmt.Sprintf("%s%s%s%s", c.Name.Label, c.Type.Label, c.Constraint, c.Reference), - FontSize: d2fonts.FONT_SIZE_L, - IsBold: false, - IsItalic: false, - Shape: "sql_table", +func (c SQLColumn) Texts() []*MText { + return []*MText{ + { + Text: c.Name.Label, + FontSize: c.Name.FontSize, + IsBold: false, + IsItalic: false, + Shape: "sql_table", + }, + { + Text: c.Type.Label, + FontSize: c.Type.FontSize, + IsBold: false, + IsItalic: false, + Shape: "sql_table", + }, } }