summaryrefslogtreecommitdiffstats
path: root/store/sql_store.go
diff options
context:
space:
mode:
Diffstat (limited to 'store/sql_store.go')
-rw-r--r--store/sql_store.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/store/sql_store.go b/store/sql_store.go
index 688e1b116..0979579df 100644
--- a/store/sql_store.go
+++ b/store/sql_store.go
@@ -582,9 +582,16 @@ func (ss SqlStore) RemoveIndexIfExists(indexName string, tableName string) {
}
}
-func IsUniqueConstraintError(err string, mysql string, postgres string) bool {
+func IsUniqueConstraintError(err string, indexName []string) bool {
unique := strings.Contains(err, "unique constraint") || strings.Contains(err, "Duplicate entry")
- field := strings.Contains(err, mysql) || strings.Contains(err, postgres)
+ field := false
+ for _, contain := range indexName {
+ if strings.Contains(err, contain) {
+ field = true
+ break
+ }
+ }
+
return unique && field
}