Skip to content

Commit

Permalink
fix go-zero issue #3328
Browse files Browse the repository at this point in the history
  • Loading branch information
kesonan committed Jun 14, 2023
1 parent aa7e847 commit 728584b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions parser/columndefinition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ func TestVisitor_VisitColumnDefinition(t *testing.T) {
columnDefinition = v.(*ColumnDefinition)

assert.Equal(t, ColumnConstraint{
AutoIncrement: true,
Unique: true,
AutoIncrement: true,
Unique: true,
HasDefaultValue: false,
}, *columnDefinition.ColumnConstraint)

v, err = p.testMysqlSyntax("test.sql", accept, `bigint(20) NULL DEFAULT NULL AUTO_INCREMENT UNIQUE KEY`)
Expand Down
2 changes: 1 addition & 1 deletion parser/columndefinition_visitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (v *visitor) visitDefaultColumnConstraint(ctx *gen.DefaultColumnConstraintC
text = strings.Trim(text, "'")
replacer := strings.NewReplacer("\r", "", "\n", "")
text = replacer.Replace(text)
if strings.ToUpper(text) == "NULL" {
if strings.HasPrefix(strings.ToUpper(text), "NULL") {
return false
}

Expand Down

0 comments on commit 728584b

Please sign in to comment.