Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoMigrate keeps receating indexes if model has composite unique indexes #6542

Closed
IrineSistiana opened this issue Aug 23, 2023 · 2 comments
Closed
Assignees
Labels
type:with reproduction steps with reproduction steps

Comments

@IrineSistiana
Copy link

IrineSistiana commented Aug 23, 2023

GORM Playground Link

go-gorm/playground#643

Description

初步 debug 了一下。如果只声明一个 uniqueIndex ,这里的 field.Unique 是 true 不会触发重建 index。但如果声明多个 uniqueIndex 组成 composite unique indexes,每个 field.Unique 都是 false 。导致每次 AutoMigrate() 都会触发多次重建 index:

if unique, ok := columnType.Unique(); ok && unique != field.Unique {

@github-actions github-actions bot added the type:with reproduction steps with reproduction steps label Aug 23, 2023
@IrineSistiana IrineSistiana changed the title AutoMigrate keeps receating tables if model has composite unique indexes AutoMigrate keeps receating indexes if model has composite unique indexes Sep 3, 2023
@starudream
Copy link

我今天也碰到这个问题了,已经看到 pr 了,等修复吧。

#6386

@a631807682
Copy link
Member

#6381 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:with reproduction steps with reproduction steps
Projects
None yet
Development

No branches or pull requests

4 participants