GORM Playground Link
https://github.com/go-gorm/playground/pull/643
Description
初步 debug 了一下。如果只声明一个 uniqueIndex ,这里的 field.Unique 是 true 不会触发重建 index。但如果声明多个 uniqueIndex 组成 composite unique indexes,每个 field.Unique 都是 false 。导致每次 AutoMigrate() 都会触发多次重建 index:
https://github.com/go-gorm/gorm/blob/ac07543962994da4c6994ba3907417d7835a2619/migrator/migrator.go#L500
Comment From: starudream
我今天也碰到这个问题了,已经看到 pr 了,等修复吧。
6386
Comment From: a631807682
https://github.com/go-gorm/gorm/issues/6381#issuecomment-1929427042