Skip to content

Commit dba70db

Browse files
authored
Fix same type comparing (#261)
* Fix same type comparing `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. * Use strings.EqualFold to compare types
1 parent 1139318 commit dba70db

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

migrator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func (m Migrator) AlterColumn(value interface{}, field string) error {
312312
fileType := clause.Expr{SQL: m.DataTypeOf(field)}
313313
// check for typeName and SQL name
314314
isSameType := true
315-
if fieldColumnType.DatabaseTypeName() != fileType.SQL {
315+
if strings.EqualFold(fieldColumnType.DatabaseTypeName(), fileType.SQL) {
316316
isSameType = false
317317
// if different, also check for aliases
318318
aliases := m.GetTypeAliases(fieldColumnType.DatabaseTypeName())

0 commit comments

Comments
 (0)