Skip to content

Commit 5bf2fd8

Browse files
committed
fix: supported for github's mermaid
Signed-off-by: ayumin <[email protected]>
1 parent 95b406e commit 5bf2fd8

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

db/column.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ func (c *Column) ToMermaid() string {
3131
mermaidType := c.Type
3232

3333
// mermaid cannot display Type Column "()" and "unsigned"
34-
mermaidType = strings.Replace(mermaidType, "(", "[", -1)
35-
mermaidType = strings.Replace(mermaidType, ")", "]", -1)
34+
mermaidType = strings.Replace(mermaidType, "(", "_", -1)
35+
mermaidType = strings.Replace(mermaidType, ")", "", -1)
3636

3737
mermaidType = strings.Replace(mermaidType, " ", "_", -1)
3838

db/schema_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func TestSchema_ToMermaid(t *testing.T) {
194194
want: `erDiagram
195195
196196
articles {
197-
integer[10]_unsigned id PK "not null"
197+
integer_10_unsigned id PK "not null"
198198
integer user_id FK "not null"
199199
}
200200
@@ -240,7 +240,7 @@ users ||--o{ articles : owns`,
240240
want: `erDiagram
241241
242242
articles {
243-
integer[10]_unsigned id PK "not null"
243+
integer_10_unsigned id PK "not null"
244244
integer user_id FK "not null"
245245
}`,
246246
},

db/table_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ func TestTable_ToMermaid(t *testing.T) {
266266
showComment: true,
267267
},
268268
want: `articles {
269-
integer[10]_unsigned id PK "not null"
269+
integer_10_unsigned id PK "not null"
270270
integer user_id FK "not null"
271271
text title
272272
}`,
@@ -304,7 +304,7 @@ func TestTable_ToMermaid(t *testing.T) {
304304
showComment: false,
305305
},
306306
want: `articles {
307-
integer[10]_unsigned id
307+
integer_10_unsigned id
308308
integer user_id
309309
text title
310310
}`,

0 commit comments

Comments
 (0)