diff --git a/sync.go b/sync.go index 5247b83d..b8b827da 100644 --- a/sync.go +++ b/sync.go @@ -171,7 +171,8 @@ func (session *Session) SyncWithOptions(opts SyncOptions, beans ...interface{}) tbNameWithSchema, col.Name, curType, expectedType) } } else if strings.HasPrefix(curType, schemas.Varchar) && strings.HasPrefix(expectedType, schemas.Varchar) { - if engine.dialect.URI().DBType == schemas.MYSQL { + if engine.dialect.URI().DBType == schemas.POSTGRES || + engine.dialect.URI().DBType == schemas.MYSQL { if oriCol.Length < col.Length { engine.logger.Infof("Table %s column %s change type from varchar(%d) to varchar(%d)\n", tbNameWithSchema, col.Name, oriCol.Length, col.Length) @@ -187,7 +188,8 @@ func (session *Session) SyncWithOptions(opts SyncOptions, beans ...interface{}) } } } else if expectedType == schemas.Varchar { - if engine.dialect.URI().DBType == schemas.MYSQL { + if engine.dialect.URI().DBType == schemas.POSTGRES || + engine.dialect.URI().DBType == schemas.MYSQL { if oriCol.Length < col.Length { engine.logger.Infof("Table %s column %s change type from varchar(%d) to varchar(%d)\n", tbNameWithSchema, col.Name, oriCol.Length, col.Length)