Skip to content

Commit 728584b

Browse files
committed
fix go-zero issue #3328
1 parent aa7e847 commit 728584b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

parser/columndefinition_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ func TestVisitor_VisitColumnDefinition(t *testing.T) {
5858
columnDefinition = v.(*ColumnDefinition)
5959

6060
assert.Equal(t, ColumnConstraint{
61-
AutoIncrement: true,
62-
Unique: true,
61+
AutoIncrement: true,
62+
Unique: true,
63+
HasDefaultValue: false,
6364
}, *columnDefinition.ColumnConstraint)
6465

6566
v, err = p.testMysqlSyntax("test.sql", accept, `bigint(20) NULL DEFAULT NULL AUTO_INCREMENT UNIQUE KEY`)

parser/columndefinition_visitor.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (v *visitor) visitDefaultColumnConstraint(ctx *gen.DefaultColumnConstraintC
9696
text = strings.Trim(text, "'")
9797
replacer := strings.NewReplacer("\r", "", "\n", "")
9898
text = replacer.Replace(text)
99-
if strings.ToUpper(text) == "NULL" {
99+
if strings.HasPrefix(strings.ToUpper(text), "NULL") {
100100
return false
101101
}
102102

0 commit comments

Comments
 (0)