Skip to content

Commit

Permalink
Fix same type comparing
Browse files Browse the repository at this point in the history
`fieldColumnType.DatabaseTypeName()` returns non capitalized string, while `fileType.SQL` returns capitalized string.
This commit aims to fix this and avoid detecting a type change when the type did not change.
  • Loading branch information
0marq committed Mar 15, 2024
1 parent 1139318 commit 32b4f95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ func (m Migrator) AlterColumn(value interface{}, field string) error {
fileType := clause.Expr{SQL: m.DataTypeOf(field)}
// check for typeName and SQL name
isSameType := true
if fieldColumnType.DatabaseTypeName() != fileType.SQL {
if strings.ToUpper(fieldColumnType.DatabaseTypeName()) != fileType.SQL {
isSameType = false
// if different, also check for aliases
aliases := m.GetTypeAliases(fieldColumnType.DatabaseTypeName())
Expand Down

0 comments on commit 32b4f95

Please sign in to comment.