Skip to content

Commit

Permalink
fix: fix gen sql bug
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkgos committed May 13, 2024
1 parent f6c529b commit 35eccc7
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions driver/mysql/def_atlas.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@ func intoColumnSql(col *schema.Column) string {
} else {
switch x := schema.UnderlyingExpr(col.Default).(type) {
case *schema.Literal:
dv := x.V
if dv == `""` || dv == "" {
dv = "''"
} else {
dv = strings.Trim(dv, `"`) // format: `"xxx"` or `'xxx'`
}
fmt.Fprintf(b, " DEFAULT '%s'", strings.Trim(dv, `"`))
fmt.Fprintf(b, " DEFAULT '%s'", strings.Trim(x.V, `"`))
case *schema.RawExpr:
fmt.Fprintf(b, " DEFAULT %s", x.X)
case nil:
Expand Down

0 comments on commit 35eccc7

Please sign in to comment.