Skip to content

Commit

Permalink
trim default value to fix mariadb
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Feb 19, 2022
1 parent 4d74602 commit 8149e87
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions migrator.go
Expand Up @@ -202,6 +202,8 @@ func (m Migrator) ColumnTypes(value interface{}) ([]gorm.ColumnType, error) {
column.AutoIncrementValue = sql.NullBool{Bool: true, Valid: true}
}

column.DefaultValueValue.String = strings.Trim(column.DefaultValueValue.String, "'")

if datetimePrecision.Valid {
column.DecimalSizeValue = datetimePrecision
}
Expand Down

1 comment on commit 8149e87

@michaelzx
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the field type is bit (1) and the default value is b'0'. The final result will become b'0

Please sign in to comment.