go-gorm / gorm

The fantastic ORM library for Golang, aims to be developer friendly
https://gorm.io
MIT License
36.91k stars 3.93k forks source link

Postgres: AutoMigrate re-migrates everytime for some types #6557

Open moolitayer opened 1 year ago

moolitayer commented 1 year ago

GORM Playground Link

https://github.com/go-gorm/playground/pull/646

Description

Every time we run AutoMigrage we get re-migration for certain specification of types:

# Types
type:character varying
type:timestamp with time zone
type:varchar[]

A workaround is to specify the types in a different way (see reproduction) but the required types seems sphoradic. Not sure why, but the issue did not force migration before we upgraded GORM and the Postgres driver.

See the attached reproduction for details.

moolitayer commented 1 year ago

@jinzhu PTAL, I haven't been able to get to the root cause of this issue. Does this report make sense? Is there a way as a user of GORM to overcome the bug?

aliyoge commented 1 year ago

I have encountered the same issue, and each time it requires a conversion from character varying to varchar(32).