summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2017-08-03 14:03:29 -0700
committerGitHub <noreply@github.com>2017-08-03 14:03:29 -0700
commit2dbe30cba37bc771d5ac8038104d3364c889dfb0 (patch)
treebe9461622465b75c0490e443bae15ebc745a5c1f /store
parent304377c427d8db950fa436e2059e770baaf67405 (diff)
downloadchat-2dbe30cba37bc771d5ac8038104d3364c889dfb0.tar.gz
chat-2dbe30cba37bc771d5ac8038104d3364c889dfb0.tar.bz2
chat-2dbe30cba37bc771d5ac8038104d3364c889dfb0.zip
Adding debugging to index creation (#7053)
* Adding debugging to index creation * Fixing debug stmt * Fixing debug stmt
Diffstat (limited to 'store')
-rw-r--r--store/sql_supplier.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/store/sql_supplier.go b/store/sql_supplier.go
index a5f4f71b6..5997a1339 100644
--- a/store/sql_supplier.go
+++ b/store/sql_supplier.go
@@ -557,9 +557,9 @@ func (ss *SqlSupplier) createIndexIfNotExists(indexName string, tableName string
}
if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_POSTGRES {
- _, err := ss.GetMaster().SelectStr("SELECT $1::regclass", indexName)
+ _, errExists := ss.GetMaster().SelectStr("SELECT $1::regclass", indexName)
// It should fail if the index does not exist
- if err == nil {
+ if errExists == nil {
return false
}
@@ -571,8 +571,9 @@ func (ss *SqlSupplier) createIndexIfNotExists(indexName string, tableName string
query = "CREATE " + uniqueStr + "INDEX " + indexName + " ON " + tableName + " (" + columnName + ")"
}
- _, err = ss.GetMaster().ExecNoTimeout(query)
+ _, err := ss.GetMaster().ExecNoTimeout(query)
if err != nil {
+ l4g.Critical(utils.T("store.sql.create_index.critical"), errExists)
l4g.Critical(utils.T("store.sql.create_index.critical"), err)
time.Sleep(time.Second)
os.Exit(EXIT_CREATE_INDEX_POSTGRES)