diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2015-10-19 14:24:02 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2015-10-19 14:24:02 -0400 |
commit | d139c9e825d0149329d90684ebe2d6b31a728b16 (patch) | |
tree | 484dfe912010791e4eef9fa0152a4b1e3ba987e9 /store/sql_store.go | |
parent | fd69910fab332642a7793e64064169e89eb0c3de (diff) | |
parent | c7d00de68291f5a53353c1391d4548d3f2ec7c0c (diff) | |
download | chat-d139c9e825d0149329d90684ebe2d6b31a728b16.tar.gz chat-d139c9e825d0149329d90684ebe2d6b31a728b16.tar.bz2 chat-d139c9e825d0149329d90684ebe2d6b31a728b16.zip |
Merge pull request #1108 from mattermost/plt-235
PLT-235 Implement outgoing webhooks.
Diffstat (limited to 'store/sql_store.go')
-rw-r--r-- | store/sql_store.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/store/sql_store.go b/store/sql_store.go index 692ac2664..c5bf840a1 100644 --- a/store/sql_store.go +++ b/store/sql_store.go @@ -30,6 +30,11 @@ import ( "github.com/mattermost/platform/utils" ) +const ( + INDEX_TYPE_FULL_TEXT = "full_text" + INDEX_TYPE_DEFAULT = "default" +) + type SqlStore struct { master *gorp.DbMap replicas []*gorp.DbMap @@ -363,14 +368,14 @@ func (ss SqlStore) RemoveColumnIfExists(tableName string, columnName string) boo // } func (ss SqlStore) CreateIndexIfNotExists(indexName string, tableName string, columnName string) { - ss.createIndexIfNotExists(indexName, tableName, columnName, false) + ss.createIndexIfNotExists(indexName, tableName, columnName, INDEX_TYPE_DEFAULT) } func (ss SqlStore) CreateFullTextIndexIfNotExists(indexName string, tableName string, columnName string) { - ss.createIndexIfNotExists(indexName, tableName, columnName, true) + ss.createIndexIfNotExists(indexName, tableName, columnName, INDEX_TYPE_FULL_TEXT) } -func (ss SqlStore) createIndexIfNotExists(indexName string, tableName string, columnName string, fullText bool) { +func (ss SqlStore) createIndexIfNotExists(indexName string, tableName string, columnName string, indexType string) { if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_POSTGRES { _, err := ss.GetMaster().SelectStr("SELECT $1::regclass", indexName) @@ -380,7 +385,7 @@ func (ss SqlStore) createIndexIfNotExists(indexName string, tableName string, co } query := "" - if fullText { + if indexType == INDEX_TYPE_FULL_TEXT { query = "CREATE INDEX " + indexName + " ON " + tableName + " USING gin(to_tsvector('english', " + columnName + "))" } else { query = "CREATE INDEX " + indexName + " ON " + tableName + " (" + columnName + ")" @@ -406,7 +411,7 @@ func (ss SqlStore) createIndexIfNotExists(indexName string, tableName string, co } fullTextIndex := "" - if fullText { + if indexType == INDEX_TYPE_FULL_TEXT { fullTextIndex = " FULLTEXT " } |