diff --git a/migrator/migrator.go b/migrator/migrator.go index acce5df21..b43f20f64 100644 --- a/migrator/migrator.go +++ b/migrator/migrator.go @@ -459,7 +459,7 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy isSameType = fullDataType == realDataType ) - if !field.PrimaryKey { + if !isSameType && !field.PrimaryKey { // check type if !strings.HasPrefix(fullDataType, realDataType) { // check type aliases @@ -474,6 +474,8 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy if !isSameType { alterColumn = true } + } else { + isSameType = true } }