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

PG index options handle CONCURRENT option separately #297

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
PG index options handle CONCURRENT option separately
abbyssoul committed Jan 12, 2025

Verified

This commit was signed with the committer’s verified signature.
JounQin JounQin
commit 13e7709145958bb4baaaf4765ee68ebc7179e46b
5 changes: 3 additions & 2 deletions migrator.go
Original file line number Diff line number Diff line change
@@ -130,7 +130,8 @@ func (m Migrator) CreateIndex(value interface{}, name string) error {
}
createIndexSQL += "INDEX "

if strings.TrimSpace(strings.ToUpper(idx.Option)) == "CONCURRENTLY" {
hasConcurrentOption := strings.TrimSpace(strings.ToUpper(idx.Option)) == "CONCURRENTLY"
if hasConcurrentOption {
createIndexSQL += "CONCURRENTLY "
}

@@ -142,7 +143,7 @@ func (m Migrator) CreateIndex(value interface{}, name string) error {
createIndexSQL += " ?"
}

if idx.Option != "" {
if idx.Option != "" && !hasConcurrentOption {
createIndexSQL += " " + idx.Option
}