summaryrefslogtreecommitdiffstats
path: root/store/sqlstore/store.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-09-25 09:11:25 -0500
committerJoram Wilander <jwawilander@gmail.com>2017-09-25 10:11:25 -0400
commit49fe5fbf3db56fc466b8997b182ee135d7a4365d (patch)
tree1252fea09aa3ce899e2e8edb1fb7b42900f50bca /store/sqlstore/store.go
parentb2c5b97601b61f5748b46e4e386134203111ebb0 (diff)
downloadchat-49fe5fbf3db56fc466b8997b182ee135d7a4365d.tar.gz
chat-49fe5fbf3db56fc466b8997b182ee135d7a4365d.tar.bz2
chat-49fe5fbf3db56fc466b8997b182ee135d7a4365d.zip
Move sql store code into store/sqlstore package (#7502)
* move sql store code into store/sqlstore package * move non-sql constants back up to store * fix api test * derp
Diffstat (limited to 'store/sqlstore/store.go')
-rw-r--r--store/sqlstore/store.go87
1 files changed, 87 insertions, 0 deletions
diff --git a/store/sqlstore/store.go b/store/sqlstore/store.go
new file mode 100644
index 000000000..02fcaa1cb
--- /dev/null
+++ b/store/sqlstore/store.go
@@ -0,0 +1,87 @@
+// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package sqlstore
+
+import (
+ _ "github.com/go-sql-driver/mysql"
+ _ "github.com/lib/pq"
+ "github.com/mattermost/gorp"
+
+ "github.com/mattermost/mattermost-server/store"
+)
+
+/*type SqlStore struct {
+ master *gorp.DbMap
+ replicas []*gorp.DbMap
+ searchReplicas []*gorp.DbMap
+ team TeamStore
+ channel ChannelStore
+ post PostStore
+ user UserStore
+ audit AuditStore
+ compliance ComplianceStore
+ session SessionStore
+ oauth OAuthStore
+ system SystemStore
+ webhook WebhookStore
+ command CommandStore
+ preference PreferenceStore
+ license LicenseStore
+ token TokenStore
+ emoji EmojiStore
+ status StatusStore
+ fileInfo FileInfoStore
+ reaction ReactionStore
+ jobStatus JobStatusStore
+ SchemaVersion string
+ rrCounter int64
+ srCounter int64
+}*/
+
+type SqlStore interface {
+ GetCurrentSchemaVersion() string
+ GetMaster() *gorp.DbMap
+ GetSearchReplica() *gorp.DbMap
+ GetReplica() *gorp.DbMap
+ TotalMasterDbConnections() int
+ TotalReadDbConnections() int
+ TotalSearchDbConnections() int
+ MarkSystemRanUnitTests()
+ DoesTableExist(tablename string) bool
+ DoesColumnExist(tableName string, columName string) bool
+ CreateColumnIfNotExists(tableName string, columnName string, mySqlColType string, postgresColType string, defaultValue string) bool
+ RemoveColumnIfExists(tableName string, columnName string) bool
+ RemoveTableIfExists(tableName string) bool
+ RenameColumnIfExists(tableName string, oldColumnName string, newColumnName string, colType string) bool
+ GetMaxLengthOfColumnIfExists(tableName string, columnName string) string
+ AlterColumnTypeIfExists(tableName string, columnName string, mySqlColType string, postgresColType string) bool
+ CreateUniqueIndexIfNotExists(indexName string, tableName string, columnName string) bool
+ CreateIndexIfNotExists(indexName string, tableName string, columnName string) bool
+ CreateFullTextIndexIfNotExists(indexName string, tableName string, columnName string) bool
+ RemoveIndexIfExists(indexName string, tableName string) bool
+ GetAllConns() []*gorp.DbMap
+ Close()
+ Team() store.TeamStore
+ Channel() store.ChannelStore
+ Post() store.PostStore
+ User() store.UserStore
+ Audit() store.AuditStore
+ ClusterDiscovery() store.ClusterDiscoveryStore
+ Compliance() store.ComplianceStore
+ Session() store.SessionStore
+ OAuth() store.OAuthStore
+ System() store.SystemStore
+ Webhook() store.WebhookStore
+ Command() store.CommandStore
+ CommandWebhook() store.CommandWebhookStore
+ Preference() store.PreferenceStore
+ License() store.LicenseStore
+ Token() store.TokenStore
+ Emoji() store.EmojiStore
+ Status() store.StatusStore
+ FileInfo() store.FileInfoStore
+ Reaction() store.ReactionStore
+ Job() store.JobStore
+ UserAccessToken() store.UserAccessTokenStore
+}