Skip to content

Commit

Permalink
fix: For time type, the time field will be automatically updated. Eve…
Browse files Browse the repository at this point in the history
…n if the table structure is not changed, the table modification operation will be repeated.
  • Loading branch information
JAHAH committed Dec 12, 2024
1 parent f482f25 commit 6c19f3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion migrator/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6c19f3a

Please sign in to comment.