summaryrefslogtreecommitdiffstats
path: root/store/sql_store.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-05-17 12:52:10 -0700
committerChristopher Speller <crspeller@gmail.com>2016-05-17 15:52:10 -0400
commit123bfad69c405b0e78e3031d8064fd7621416867 (patch)
treeca24158452a5d151842994d57f9ceb5cc97e19c4 /store/sql_store.go
parentd2b556aa77cc8e8f7d7aef340950fb632fba2aa6 (diff)
downloadchat-123bfad69c405b0e78e3031d8064fd7621416867.tar.gz
chat-123bfad69c405b0e78e3031d8064fd7621416867.tar.bz2
chat-123bfad69c405b0e78e3031d8064fd7621416867.zip
Fixing LDAP issue with Postgres (#3033)
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
}