Skip to content

Commit 7f4b498

Browse files
committed
Fix get column default value for null column
1 parent 22036f5 commit 7f4b498

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ddlmod.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ func parseDDL(strs ...string) (*ddl, error) {
134134
columnType.PrimaryKeyValue = sql.NullBool{Bool: true, Valid: true}
135135
}
136136
if defaultMatches := defaultValueRegexp.FindStringSubmatch(matches[3]); len(defaultMatches) > 1 {
137-
columnType.DefaultValueValue = sql.NullString{String: strings.Trim(defaultMatches[1], `"`), Valid: true}
137+
if strings.ToLower(defaultMatches[1]) != "null" {
138+
columnType.DefaultValueValue = sql.NullString{String: strings.Trim(defaultMatches[1], `"`), Valid: true}
139+
}
138140
}
139141

140142
// data type length

0 commit comments

Comments
 (0)