Skip to content

Commit

Permalink
null db migration
Browse files Browse the repository at this point in the history
  • Loading branch information
iesreza committed Dec 18, 2023
1 parent 9e9fb4f commit 52cd8bc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/db/schema/ddl/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,6 @@ func FromStatement(stmt *gorm.Statement) Table {
Unique: field.Unique,
}

if len(column.Default) > 0 {
if !(column.Default[0] == '\'' || column.Default[0] == '"' || column.Default[0] == '`') {
column.Default = strconv.Quote(column.Default)
}
}

if v, ok := field.TagSettings["CHARSET"]; ok {
column.Charset = v
}
Expand Down Expand Up @@ -250,8 +244,13 @@ func getFieldQuery(field *Column) string {
}

if field.Default != "" {
query += " DEFAULT " + field.Default
var v = field.Default
if !(v[0] == '\'' || v[0] == '"' || v[0] == '`') {
v = strconv.Quote(v)
}
query += " DEFAULT " + v
}

if field.OnUpdate != "" {
query += " ON UPDATE " + field.OnUpdate
}
Expand Down

0 comments on commit 52cd8bc

Please sign in to comment.