Remove redundant percision check for migrator

extra checking can cause "tag:percision" to lose meaning
This commit is contained in:
wushu 2021-12-08 14:19:29 +08:00
parent e5bdd610c3
commit 52103dd623

View File

@ -407,10 +407,8 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy
// check precision
if precision, _, ok := columnType.DecimalSize(); ok && int64(field.Precision) != precision {
if regexp.MustCompile(fmt.Sprintf("[^0-9]%d[^0-9]", field.Precision)).MatchString(m.DataTypeOf(field)) {
alterColumn = true
}
}
// check nullable
if nullable, ok := columnType.Nullable(); ok && nullable == field.NotNull {