mirror of https://github.com/go-gorm/gorm.git
fix: For time type, the time field will be automatically updated. Even if the table structure is not changed, the table modification operation will be repeated.
This commit is contained in:
parent
f482f25c71
commit
6c19f3ac0f
|
@ -543,7 +543,7 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy
|
||||||
} else if currentDefaultNotNull || dvNotNull {
|
} else if currentDefaultNotNull || dvNotNull {
|
||||||
switch field.GORMDataType {
|
switch field.GORMDataType {
|
||||||
case schema.Time:
|
case schema.Time:
|
||||||
if !strings.EqualFold(strings.TrimSuffix(dv, "()"), strings.TrimSuffix(field.DefaultValue, "()")) {
|
if !strings.EqualFold(strings.Split(dv, "(")[0], strings.Split(field.DefaultValue, "(")[0]) {
|
||||||
alterColumn = true
|
alterColumn = true
|
||||||
}
|
}
|
||||||
case schema.Bool:
|
case schema.Bool:
|
||||||
|
|
Loading…
Reference in New Issue