mirror of https://github.com/go-gorm/gorm.git
Fix auto migrate field with customized field type, close https://github.com/go-gorm/mysql/issues/20
This commit is contained in:
parent
77bf4aecc6
commit
59730417aa
|
@ -381,7 +381,7 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy
|
|||
|
||||
// check precision
|
||||
if precision, _, ok := columnType.DecimalSize(); ok && int64(field.Precision) != precision {
|
||||
if strings.Contains(m.DataTypeOf(field), fmt.Sprint(field.Precision)) {
|
||||
if regexp.MustCompile(fmt.Sprintf("[^0-9]%d[^0-9]", field.Precision)).MatchString(m.DataTypeOf(field)) {
|
||||
alterColumn = true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue