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:
jm 2024-12-12 16:08:23 +04:00
parent f482f25c71
commit 6c19f3ac0f
1 changed files with 1 additions and 1 deletions

View File

@ -543,7 +543,7 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy
} else if currentDefaultNotNull || dvNotNull {
switch field.GORMDataType {
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
}
case schema.Bool: