diff --git a/migrator.go b/migrator.go index 210c2cb..5eb0acc 100644 --- a/migrator.go +++ b/migrator.go @@ -478,6 +478,12 @@ func (m Migrator) ColumnTypes(value interface{}) (columnTypes []gorm.ColumnType, mc := c.(*migrator.ColumnType) if mc.NameValue.String == name { mc.ColumnTypeValue = sql.NullString{String: dataType, Valid: true} + // Handle array type: _text -> text[] , _int4 -> integer[] + // Not support array size limits and array size limits because: + // https://www.postgresql.org/docs/current/arrays.html#ARRAYS-DECLARATION + if strings.HasPrefix(mc.DataTypeValue.String, "_") { + mc.DataTypeValue = sql.NullString{String: dataType, Valid: true} + } break } }