Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Ensure vitessio#8425 is applied after file split
Browse files Browse the repository at this point in the history
git seemed to not apply this change after the formatting functions got
moved from `ast.go` to `ast_format.go`

Signed-off-by: Andrew Mason <amason@slack-corp.com>
  • Loading branch information
ajm188 committed Jul 18, 2021
1 parent f97e49f commit 6ec68f1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
9 changes: 8 additions & 1 deletion go/vt/sqlparser/ast_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,14 @@ func (ct *ColumnType) Format(buf *TrackedBuffer) {
}
}
if ct.Options.Default != nil {
buf.astPrintf(ct, " %s %v", keywordStrings[DEFAULT], ct.Options.Default)
buf.astPrintf(ct, " %s", keywordStrings[DEFAULT])
_, isLiteral := ct.Options.Default.(*Literal)
_, isNullVal := ct.Options.Default.(*NullVal)
if isLiteral || isNullVal {
buf.astPrintf(ct, " %v", String(ct.Options.Default))
} else {
buf.astPrintf(ct, " (%v)", String(ct.Options.Default))
}
}
if ct.Options.OnUpdate != nil {
buf.astPrintf(ct, " %s %s %v", keywordStrings[ON], keywordStrings[UPDATE], ct.Options.OnUpdate)
Expand Down
12 changes: 10 additions & 2 deletions go/vt/sqlparser/ast_format_fast.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6ec68f1

Please sign in to comment.