Skip to content

Commit

Permalink
fix: PostgreSql create index occur error
Browse files Browse the repository at this point in the history
Signed-off-by: 张奇峰 <1990966837@qq.com>
  • Loading branch information
张奇峰 committed Aug 4, 2021
1 parent b1c6689 commit 232e0dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ func (a *Adapter) createTable() error {
}

tableName := a.getFullTableName()
index := "idx_" + tableName
index := strings.ReplaceAll("idx_"+tableName, ".", "_")
hasIndex := a.db.Migrator().HasIndex(t, index)
if !hasIndex {
if err := a.db.Exec(fmt.Sprintf("CREATE UNIQUE INDEX %s ON %s (ptype,v0,v1,v2,v3,v4,v5)", index, tableName)).Error; err != nil {
Expand Down

0 comments on commit 232e0dc

Please sign in to comment.