Skip to content

Commit 04418c9

Browse files
authored
PG index options handle CONCURRENT option separately (#297)
1 parent 9723eac commit 04418c9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: migrator.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ func (m Migrator) CreateIndex(value interface{}, name string) error {
130130
}
131131
createIndexSQL += "INDEX "
132132

133-
if strings.TrimSpace(strings.ToUpper(idx.Option)) == "CONCURRENTLY" {
133+
hasConcurrentOption := strings.TrimSpace(strings.ToUpper(idx.Option)) == "CONCURRENTLY"
134+
if hasConcurrentOption {
134135
createIndexSQL += "CONCURRENTLY "
135136
}
136137

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

145-
if idx.Option != "" && strings.TrimSpace(strings.ToUpper(idx.Option)) != "CONCURRENTLY" {
146+
if idx.Option != "" && !hasConcurrentOption {
146147
createIndexSQL += " " + idx.Option
147148
}
148149

0 commit comments

Comments
 (0)