Making private some sqlstore methods (#13895)
* Making private some sqlstore methods * Calling for create indexes on missing stores Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
aec606500f
Коммит
2a5d30f8f3
@@ -14,7 +14,7 @@ type SqlAuditStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlAuditStore(sqlStore SqlStore) store.AuditStore {
|
||||
func newSqlAuditStore(sqlStore SqlStore) store.AuditStore {
|
||||
s := &SqlAuditStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -30,7 +30,7 @@ func NewSqlAuditStore(sqlStore SqlStore) store.AuditStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlAuditStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlAuditStore) createIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_audits_user_id", "Audits", "UserId")
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ type SqlBotStore struct {
|
||||
metrics einterfaces.MetricsInterface
|
||||
}
|
||||
|
||||
// NewSqlBotStore creates an instance of SqlBotStore, registering the table schema in question.
|
||||
func NewSqlBotStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.BotStore {
|
||||
// newSqlBotStore creates an instance of SqlBotStore, registering the table schema in question.
|
||||
func newSqlBotStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.BotStore {
|
||||
us := &SqlBotStore{
|
||||
SqlStore: sqlStore,
|
||||
metrics: metrics,
|
||||
@@ -61,7 +61,7 @@ func NewSqlBotStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) sto
|
||||
return us
|
||||
}
|
||||
|
||||
func (us SqlBotStore) CreateIndexesIfNotExists() {
|
||||
func (us SqlBotStore) createIndexesIfNotExists() {
|
||||
}
|
||||
|
||||
// traceBot is a helper function for adding to a bot trace when logging.
|
||||
|
||||
@@ -16,7 +16,7 @@ type SqlChannelMemberHistoryStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlChannelMemberHistoryStore(sqlStore SqlStore) store.ChannelMemberHistoryStore {
|
||||
func newSqlChannelMemberHistoryStore(sqlStore SqlStore) store.ChannelMemberHistoryStore {
|
||||
s := &SqlChannelMemberHistoryStore{
|
||||
SqlStore: sqlStore,
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ func (s SqlChannelStore) ClearCaches() {
|
||||
}
|
||||
}
|
||||
|
||||
func NewSqlChannelStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.ChannelStore {
|
||||
func newSqlChannelStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.ChannelStore {
|
||||
s := &SqlChannelStore{
|
||||
SqlStore: sqlStore,
|
||||
metrics: metrics,
|
||||
@@ -328,7 +328,7 @@ func NewSqlChannelStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlChannelStore) createIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_channels_team_id", "Channels", "TeamId")
|
||||
s.CreateIndexIfNotExists("idx_channels_name", "Channels", "Name")
|
||||
s.CreateIndexIfNotExists("idx_channels_update_at", "Channels", "UpdateAt")
|
||||
|
||||
@@ -14,7 +14,7 @@ type sqlClusterDiscoveryStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlClusterDiscoveryStore(sqlStore SqlStore) store.ClusterDiscoveryStore {
|
||||
func newSqlClusterDiscoveryStore(sqlStore SqlStore) store.ClusterDiscoveryStore {
|
||||
s := &sqlClusterDiscoveryStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
|
||||
@@ -14,7 +14,7 @@ type SqlCommandStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlCommandStore(sqlStore SqlStore) store.CommandStore {
|
||||
func newSqlCommandStore(sqlStore SqlStore) store.CommandStore {
|
||||
s := &SqlCommandStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -37,7 +37,7 @@ func NewSqlCommandStore(sqlStore SqlStore) store.CommandStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlCommandStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlCommandStore) createIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_command_team_id", "Commands", "TeamId")
|
||||
s.CreateIndexIfNotExists("idx_command_update_at", "Commands", "UpdateAt")
|
||||
s.CreateIndexIfNotExists("idx_command_create_at", "Commands", "CreateAt")
|
||||
|
||||
@@ -16,7 +16,7 @@ type SqlCommandWebhookStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlCommandWebhookStore(sqlStore SqlStore) store.CommandWebhookStore {
|
||||
func newSqlCommandWebhookStore(sqlStore SqlStore) store.CommandWebhookStore {
|
||||
s := &SqlCommandWebhookStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -32,7 +32,7 @@ func NewSqlCommandWebhookStore(sqlStore SqlStore) store.CommandWebhookStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlCommandWebhookStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlCommandWebhookStore) createIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_command_webhook_create_at", "CommandWebhooks", "CreateAt")
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ type SqlComplianceStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlComplianceStore(sqlStore SqlStore) store.ComplianceStore {
|
||||
func newSqlComplianceStore(sqlStore SqlStore) store.ComplianceStore {
|
||||
s := &SqlComplianceStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -33,7 +33,7 @@ func NewSqlComplianceStore(sqlStore SqlStore) store.ComplianceStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlComplianceStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlComplianceStore) createIndexesIfNotExists() {
|
||||
}
|
||||
|
||||
func (s SqlComplianceStore) Save(compliance *model.Compliance) (*model.Compliance, *model.AppError) {
|
||||
|
||||
@@ -18,7 +18,7 @@ type SqlEmojiStore struct {
|
||||
metrics einterfaces.MetricsInterface
|
||||
}
|
||||
|
||||
func NewSqlEmojiStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.EmojiStore {
|
||||
func newSqlEmojiStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.EmojiStore {
|
||||
s := &SqlEmojiStore{
|
||||
SqlStore: sqlStore,
|
||||
metrics: metrics,
|
||||
@@ -36,7 +36,7 @@ func NewSqlEmojiStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) s
|
||||
return s
|
||||
}
|
||||
|
||||
func (es SqlEmojiStore) CreateIndexesIfNotExists() {
|
||||
func (es SqlEmojiStore) createIndexesIfNotExists() {
|
||||
es.CreateIndexIfNotExists("idx_emoji_update_at", "Emoji", "UpdateAt")
|
||||
es.CreateIndexIfNotExists("idx_emoji_create_at", "Emoji", "CreateAt")
|
||||
es.CreateIndexIfNotExists("idx_emoji_delete_at", "Emoji", "DeleteAt")
|
||||
|
||||
@@ -36,7 +36,7 @@ func (fs SqlFileInfoStore) ClearCaches() {
|
||||
}
|
||||
}
|
||||
|
||||
func NewSqlFileInfoStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.FileInfoStore {
|
||||
func newSqlFileInfoStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.FileInfoStore {
|
||||
s := &SqlFileInfoStore{
|
||||
SqlStore: sqlStore,
|
||||
metrics: metrics,
|
||||
@@ -58,7 +58,7 @@ func NewSqlFileInfoStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface
|
||||
return s
|
||||
}
|
||||
|
||||
func (fs SqlFileInfoStore) CreateIndexesIfNotExists() {
|
||||
func (fs SqlFileInfoStore) createIndexesIfNotExists() {
|
||||
fs.CreateIndexIfNotExists("idx_fileinfo_update_at", "FileInfo", "UpdateAt")
|
||||
fs.CreateIndexIfNotExists("idx_fileinfo_create_at", "FileInfo", "CreateAt")
|
||||
fs.CreateIndexIfNotExists("idx_fileinfo_delete_at", "FileInfo", "DeleteAt")
|
||||
|
||||
@@ -51,7 +51,7 @@ type SqlGroupStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlGroupStore(sqlStore SqlStore) store.GroupStore {
|
||||
func newSqlGroupStore(sqlStore SqlStore) store.GroupStore {
|
||||
s := &SqlGroupStore{SqlStore: sqlStore}
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
groups := db.AddTableWithName(model.Group{}, "UserGroups").SetKeys(false, "Id")
|
||||
@@ -78,7 +78,7 @@ func NewSqlGroupStore(sqlStore SqlStore) store.GroupStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *SqlGroupStore) CreateIndexesIfNotExists() {
|
||||
func (s *SqlGroupStore) createIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_groupmembers_create_at", "GroupMembers", "CreateAt")
|
||||
s.CreateIndexIfNotExists("idx_usergroups_remote_id", "UserGroups", "RemoteId")
|
||||
s.CreateIndexIfNotExists("idx_usergroups_delete_at", "UserGroups", "DeleteAt")
|
||||
|
||||
@@ -16,7 +16,7 @@ type SqlJobStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlJobStore(sqlStore SqlStore) store.JobStore {
|
||||
func newSqlJobStore(sqlStore SqlStore) store.JobStore {
|
||||
s := &SqlJobStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -30,7 +30,7 @@ func NewSqlJobStore(sqlStore SqlStore) store.JobStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (jss SqlJobStore) CreateIndexesIfNotExists() {
|
||||
func (jss SqlJobStore) createIndexesIfNotExists() {
|
||||
jss.CreateIndexIfNotExists("idx_jobs_type", "Jobs", "Type")
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ type SqlLicenseStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlLicenseStore(sqlStore SqlStore) store.LicenseStore {
|
||||
func newSqlLicenseStore(sqlStore SqlStore) store.LicenseStore {
|
||||
ls := &SqlLicenseStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -26,7 +26,7 @@ func NewSqlLicenseStore(sqlStore SqlStore) store.LicenseStore {
|
||||
return ls
|
||||
}
|
||||
|
||||
func (ls SqlLicenseStore) CreateIndexesIfNotExists() {
|
||||
func (ls SqlLicenseStore) createIndexesIfNotExists() {
|
||||
}
|
||||
|
||||
func (ls SqlLicenseStore) Save(license *model.LicenseRecord) (*model.LicenseRecord, *model.AppError) {
|
||||
|
||||
@@ -15,7 +15,7 @@ type SqlLinkMetadataStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlLinkMetadataStore(sqlStore SqlStore) store.LinkMetadataStore {
|
||||
func newSqlLinkMetadataStore(sqlStore SqlStore) store.LinkMetadataStore {
|
||||
s := &SqlLinkMetadataStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -28,7 +28,7 @@ func NewSqlLinkMetadataStore(sqlStore SqlStore) store.LinkMetadataStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlLinkMetadataStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlLinkMetadataStore) createIndexesIfNotExists() {
|
||||
if s.DriverName() == model.DATABASE_DRIVER_MYSQL {
|
||||
s.CreateCompositeIndexIfNotExists("idx_link_metadata_url_timestamp", "LinkMetadata", []string{"URL(512)", "Timestamp"})
|
||||
} else {
|
||||
|
||||
@@ -16,7 +16,7 @@ type SqlOAuthStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlOAuthStore(sqlStore SqlStore) store.OAuthStore {
|
||||
func newSqlOAuthStore(sqlStore SqlStore) store.OAuthStore {
|
||||
as := &SqlOAuthStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -51,7 +51,7 @@ func NewSqlOAuthStore(sqlStore SqlStore) store.OAuthStore {
|
||||
return as
|
||||
}
|
||||
|
||||
func (as SqlOAuthStore) CreateIndexesIfNotExists() {
|
||||
func (as SqlOAuthStore) createIndexesIfNotExists() {
|
||||
as.CreateIndexIfNotExists("idx_oauthapps_creator_id", "OAuthApps", "CreatorId")
|
||||
as.CreateIndexIfNotExists("idx_oauthaccessdata_client_id", "OAuthAccessData", "ClientId")
|
||||
as.CreateIndexIfNotExists("idx_oauthaccessdata_user_id", "OAuthAccessData", "UserId")
|
||||
|
||||
@@ -21,7 +21,7 @@ type SqlPluginStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlPluginStore(sqlStore SqlStore) store.PluginStore {
|
||||
func newSqlPluginStore(sqlStore SqlStore) store.PluginStore {
|
||||
s := &SqlPluginStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -34,7 +34,7 @@ func NewSqlPluginStore(sqlStore SqlStore) store.PluginStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (ps SqlPluginStore) CreateIndexesIfNotExists() {
|
||||
func (ps SqlPluginStore) createIndexesIfNotExists() {
|
||||
}
|
||||
|
||||
func (ps SqlPluginStore) SaveOrUpdate(kv *model.PluginKeyValue) (*model.PluginKeyValue, *model.AppError) {
|
||||
|
||||
@@ -30,7 +30,7 @@ type SqlPostStore struct {
|
||||
func (s *SqlPostStore) ClearCaches() {
|
||||
}
|
||||
|
||||
func NewSqlPostStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.PostStore {
|
||||
func newSqlPostStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.PostStore {
|
||||
s := &SqlPostStore{
|
||||
SqlStore: sqlStore,
|
||||
metrics: metrics,
|
||||
@@ -56,7 +56,7 @@ func NewSqlPostStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) st
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) CreateIndexesIfNotExists() {
|
||||
func (s *SqlPostStore) createIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_posts_update_at", "Posts", "UpdateAt")
|
||||
s.CreateIndexIfNotExists("idx_posts_create_at", "Posts", "CreateAt")
|
||||
s.CreateIndexIfNotExists("idx_posts_delete_at", "Posts", "DeleteAt")
|
||||
|
||||
@@ -17,7 +17,7 @@ type SqlPreferenceStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlPreferenceStore(sqlStore SqlStore) store.PreferenceStore {
|
||||
func newSqlPreferenceStore(sqlStore SqlStore) store.PreferenceStore {
|
||||
s := &SqlPreferenceStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -31,13 +31,13 @@ func NewSqlPreferenceStore(sqlStore SqlStore) store.PreferenceStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlPreferenceStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlPreferenceStore) createIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_preferences_user_id", "Preferences", "UserId")
|
||||
s.CreateIndexIfNotExists("idx_preferences_category", "Preferences", "Category")
|
||||
s.CreateIndexIfNotExists("idx_preferences_name", "Preferences", "Name")
|
||||
}
|
||||
|
||||
func (s SqlPreferenceStore) DeleteUnusedFeatures() {
|
||||
func (s SqlPreferenceStore) deleteUnusedFeatures() {
|
||||
mlog.Debug("Deleting any unused pre-release features")
|
||||
|
||||
sql := `DELETE
|
||||
|
||||
@@ -55,7 +55,7 @@ func TestDeleteUnusedFeatures(t *testing.T) {
|
||||
err := ss.Preference().Save(&features)
|
||||
require.Nil(t, err)
|
||||
|
||||
ss.Preference().(*SqlPreferenceStore).DeleteUnusedFeatures()
|
||||
ss.Preference().(*SqlPreferenceStore).deleteUnusedFeatures()
|
||||
|
||||
//make sure features with value "false" have actually been deleted from the database
|
||||
if val, err := ss.Preference().(*SqlPreferenceStore).GetReplica().SelectInt(`SELECT COUNT(*)
|
||||
|
||||
@@ -71,7 +71,7 @@ func (role Role) ToModel() *model.Role {
|
||||
}
|
||||
}
|
||||
|
||||
func NewSqlRoleStore(sqlStore SqlStore) store.RoleStore {
|
||||
func newSqlRoleStore(sqlStore SqlStore) store.RoleStore {
|
||||
s := &SqlRoleStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -85,7 +85,7 @@ func NewSqlRoleStore(sqlStore SqlStore) store.RoleStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlRoleStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlRoleStore) createIndexesIfNotExists() {
|
||||
}
|
||||
|
||||
func (s *SqlRoleStore) Save(role *model.Role) (*model.Role, *model.AppError) {
|
||||
|
||||
@@ -19,7 +19,7 @@ type SqlSchemeStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlSchemeStore(sqlStore SqlStore) store.SchemeStore {
|
||||
func newSqlSchemeStore(sqlStore SqlStore) store.SchemeStore {
|
||||
s := &SqlSchemeStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -40,7 +40,7 @@ func NewSqlSchemeStore(sqlStore SqlStore) store.SchemeStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlSchemeStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlSchemeStore) createIndexesIfNotExists() {
|
||||
}
|
||||
|
||||
func (s *SqlSchemeStore) Save(scheme *model.Scheme) (*model.Scheme, *model.AppError) {
|
||||
|
||||
@@ -20,7 +20,7 @@ type SqlSessionStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlSessionStore(sqlStore SqlStore) store.SessionStore {
|
||||
func newSqlSessionStore(sqlStore SqlStore) store.SessionStore {
|
||||
us := &SqlSessionStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -36,7 +36,7 @@ func NewSqlSessionStore(sqlStore SqlStore) store.SessionStore {
|
||||
return us
|
||||
}
|
||||
|
||||
func (me SqlSessionStore) CreateIndexesIfNotExists() {
|
||||
func (me SqlSessionStore) createIndexesIfNotExists() {
|
||||
me.CreateIndexIfNotExists("idx_sessions_user_id", "Sessions", "UserId")
|
||||
me.CreateIndexIfNotExists("idx_sessions_token", "Sessions", "Token")
|
||||
me.CreateIndexIfNotExists("idx_sessions_expires_at", "Sessions", "ExpiresAt")
|
||||
|
||||
@@ -21,7 +21,7 @@ type SqlStatusStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlStatusStore(sqlStore SqlStore) store.StatusStore {
|
||||
func newSqlStatusStore(sqlStore SqlStore) store.StatusStore {
|
||||
s := &SqlStatusStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -34,7 +34,7 @@ func NewSqlStatusStore(sqlStore SqlStore) store.StatusStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlStatusStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlStatusStore) createIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_status_user_id", "Status", "UserId")
|
||||
s.CreateIndexIfNotExists("idx_status_status", "Status", "Status")
|
||||
}
|
||||
|
||||
@@ -132,37 +132,37 @@ func NewSqlSupplier(settings model.SqlSettings, metrics einterfaces.MetricsInter
|
||||
|
||||
supplier.initConnection()
|
||||
|
||||
supplier.stores.team = NewSqlTeamStore(supplier)
|
||||
supplier.stores.channel = NewSqlChannelStore(supplier, metrics)
|
||||
supplier.stores.post = NewSqlPostStore(supplier, metrics)
|
||||
supplier.stores.user = NewSqlUserStore(supplier, metrics)
|
||||
supplier.stores.bot = NewSqlBotStore(supplier, metrics)
|
||||
supplier.stores.audit = NewSqlAuditStore(supplier)
|
||||
supplier.stores.cluster = NewSqlClusterDiscoveryStore(supplier)
|
||||
supplier.stores.compliance = NewSqlComplianceStore(supplier)
|
||||
supplier.stores.session = NewSqlSessionStore(supplier)
|
||||
supplier.stores.oauth = NewSqlOAuthStore(supplier)
|
||||
supplier.stores.system = NewSqlSystemStore(supplier)
|
||||
supplier.stores.webhook = NewSqlWebhookStore(supplier, metrics)
|
||||
supplier.stores.command = NewSqlCommandStore(supplier)
|
||||
supplier.stores.commandWebhook = NewSqlCommandWebhookStore(supplier)
|
||||
supplier.stores.preference = NewSqlPreferenceStore(supplier)
|
||||
supplier.stores.license = NewSqlLicenseStore(supplier)
|
||||
supplier.stores.token = NewSqlTokenStore(supplier)
|
||||
supplier.stores.emoji = NewSqlEmojiStore(supplier, metrics)
|
||||
supplier.stores.status = NewSqlStatusStore(supplier)
|
||||
supplier.stores.fileInfo = NewSqlFileInfoStore(supplier, metrics)
|
||||
supplier.stores.job = NewSqlJobStore(supplier)
|
||||
supplier.stores.userAccessToken = NewSqlUserAccessTokenStore(supplier)
|
||||
supplier.stores.channelMemberHistory = NewSqlChannelMemberHistoryStore(supplier)
|
||||
supplier.stores.plugin = NewSqlPluginStore(supplier)
|
||||
supplier.stores.TermsOfService = NewSqlTermsOfServiceStore(supplier, metrics)
|
||||
supplier.stores.UserTermsOfService = NewSqlUserTermsOfServiceStore(supplier)
|
||||
supplier.stores.linkMetadata = NewSqlLinkMetadataStore(supplier)
|
||||
supplier.stores.reaction = NewSqlReactionStore(supplier)
|
||||
supplier.stores.role = NewSqlRoleStore(supplier)
|
||||
supplier.stores.scheme = NewSqlSchemeStore(supplier)
|
||||
supplier.stores.group = NewSqlGroupStore(supplier)
|
||||
supplier.stores.team = newSqlTeamStore(supplier)
|
||||
supplier.stores.channel = newSqlChannelStore(supplier, metrics)
|
||||
supplier.stores.post = newSqlPostStore(supplier, metrics)
|
||||
supplier.stores.user = newSqlUserStore(supplier, metrics)
|
||||
supplier.stores.bot = newSqlBotStore(supplier, metrics)
|
||||
supplier.stores.audit = newSqlAuditStore(supplier)
|
||||
supplier.stores.cluster = newSqlClusterDiscoveryStore(supplier)
|
||||
supplier.stores.compliance = newSqlComplianceStore(supplier)
|
||||
supplier.stores.session = newSqlSessionStore(supplier)
|
||||
supplier.stores.oauth = newSqlOAuthStore(supplier)
|
||||
supplier.stores.system = newSqlSystemStore(supplier)
|
||||
supplier.stores.webhook = newSqlWebhookStore(supplier, metrics)
|
||||
supplier.stores.command = newSqlCommandStore(supplier)
|
||||
supplier.stores.commandWebhook = newSqlCommandWebhookStore(supplier)
|
||||
supplier.stores.preference = newSqlPreferenceStore(supplier)
|
||||
supplier.stores.license = newSqlLicenseStore(supplier)
|
||||
supplier.stores.token = newSqlTokenStore(supplier)
|
||||
supplier.stores.emoji = newSqlEmojiStore(supplier, metrics)
|
||||
supplier.stores.status = newSqlStatusStore(supplier)
|
||||
supplier.stores.fileInfo = newSqlFileInfoStore(supplier, metrics)
|
||||
supplier.stores.job = newSqlJobStore(supplier)
|
||||
supplier.stores.userAccessToken = newSqlUserAccessTokenStore(supplier)
|
||||
supplier.stores.channelMemberHistory = newSqlChannelMemberHistoryStore(supplier)
|
||||
supplier.stores.plugin = newSqlPluginStore(supplier)
|
||||
supplier.stores.TermsOfService = newSqlTermsOfServiceStore(supplier, metrics)
|
||||
supplier.stores.UserTermsOfService = newSqlUserTermsOfServiceStore(supplier)
|
||||
supplier.stores.linkMetadata = newSqlLinkMetadataStore(supplier)
|
||||
supplier.stores.reaction = newSqlReactionStore(supplier)
|
||||
supplier.stores.role = newSqlRoleStore(supplier)
|
||||
supplier.stores.scheme = newSqlSchemeStore(supplier)
|
||||
supplier.stores.group = newSqlGroupStore(supplier)
|
||||
|
||||
err := supplier.GetMaster().CreateTablesIfNotExists()
|
||||
if err != nil {
|
||||
@@ -178,33 +178,36 @@ func NewSqlSupplier(settings model.SqlSettings, metrics einterfaces.MetricsInter
|
||||
os.Exit(EXIT_GENERIC_FAILURE)
|
||||
}
|
||||
|
||||
supplier.stores.team.(*SqlTeamStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.channel.(*SqlChannelStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.post.(*SqlPostStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.user.(*SqlUserStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.bot.(*SqlBotStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.audit.(*SqlAuditStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.compliance.(*SqlComplianceStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.session.(*SqlSessionStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.oauth.(*SqlOAuthStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.system.(*SqlSystemStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.webhook.(*SqlWebhookStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.command.(*SqlCommandStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.commandWebhook.(*SqlCommandWebhookStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.preference.(*SqlPreferenceStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.license.(*SqlLicenseStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.token.(*SqlTokenStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.emoji.(*SqlEmojiStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.status.(*SqlStatusStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.fileInfo.(*SqlFileInfoStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.job.(*SqlJobStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.userAccessToken.(*SqlUserAccessTokenStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.plugin.(*SqlPluginStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.TermsOfService.(SqlTermsOfServiceStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.UserTermsOfService.(SqlUserTermsOfServiceStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.linkMetadata.(*SqlLinkMetadataStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.group.(*SqlGroupStore).CreateIndexesIfNotExists()
|
||||
supplier.stores.preference.(*SqlPreferenceStore).DeleteUnusedFeatures()
|
||||
supplier.stores.team.(*SqlTeamStore).createIndexesIfNotExists()
|
||||
supplier.stores.channel.(*SqlChannelStore).createIndexesIfNotExists()
|
||||
supplier.stores.post.(*SqlPostStore).createIndexesIfNotExists()
|
||||
supplier.stores.user.(*SqlUserStore).createIndexesIfNotExists()
|
||||
supplier.stores.bot.(*SqlBotStore).createIndexesIfNotExists()
|
||||
supplier.stores.audit.(*SqlAuditStore).createIndexesIfNotExists()
|
||||
supplier.stores.compliance.(*SqlComplianceStore).createIndexesIfNotExists()
|
||||
supplier.stores.session.(*SqlSessionStore).createIndexesIfNotExists()
|
||||
supplier.stores.oauth.(*SqlOAuthStore).createIndexesIfNotExists()
|
||||
supplier.stores.system.(*SqlSystemStore).createIndexesIfNotExists()
|
||||
supplier.stores.webhook.(*SqlWebhookStore).createIndexesIfNotExists()
|
||||
supplier.stores.command.(*SqlCommandStore).createIndexesIfNotExists()
|
||||
supplier.stores.commandWebhook.(*SqlCommandWebhookStore).createIndexesIfNotExists()
|
||||
supplier.stores.preference.(*SqlPreferenceStore).createIndexesIfNotExists()
|
||||
supplier.stores.license.(*SqlLicenseStore).createIndexesIfNotExists()
|
||||
supplier.stores.token.(*SqlTokenStore).createIndexesIfNotExists()
|
||||
supplier.stores.emoji.(*SqlEmojiStore).createIndexesIfNotExists()
|
||||
supplier.stores.status.(*SqlStatusStore).createIndexesIfNotExists()
|
||||
supplier.stores.fileInfo.(*SqlFileInfoStore).createIndexesIfNotExists()
|
||||
supplier.stores.job.(*SqlJobStore).createIndexesIfNotExists()
|
||||
supplier.stores.userAccessToken.(*SqlUserAccessTokenStore).createIndexesIfNotExists()
|
||||
supplier.stores.plugin.(*SqlPluginStore).createIndexesIfNotExists()
|
||||
supplier.stores.TermsOfService.(SqlTermsOfServiceStore).createIndexesIfNotExists()
|
||||
supplier.stores.UserTermsOfService.(SqlUserTermsOfServiceStore).createIndexesIfNotExists()
|
||||
supplier.stores.linkMetadata.(*SqlLinkMetadataStore).createIndexesIfNotExists()
|
||||
supplier.stores.reaction.(*SqlReactionStore).createIndexesIfNotExists()
|
||||
supplier.stores.role.(*SqlRoleStore).createIndexesIfNotExists()
|
||||
supplier.stores.scheme.(*SqlSchemeStore).createIndexesIfNotExists()
|
||||
supplier.stores.group.(*SqlGroupStore).createIndexesIfNotExists()
|
||||
supplier.stores.preference.(*SqlPreferenceStore).deleteUnusedFeatures()
|
||||
|
||||
return supplier
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ type SqlReactionStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlReactionStore(sqlStore SqlStore) store.ReactionStore {
|
||||
func newSqlReactionStore(sqlStore SqlStore) store.ReactionStore {
|
||||
s := &SqlReactionStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -29,7 +29,7 @@ func NewSqlReactionStore(sqlStore SqlStore) store.ReactionStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlReactionStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlReactionStore) createIndexesIfNotExists() {
|
||||
}
|
||||
|
||||
func (s *SqlReactionStore) Save(reaction *model.Reaction) (*model.Reaction, *model.AppError) {
|
||||
|
||||
@@ -14,7 +14,7 @@ type SqlSystemStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlSystemStore(sqlStore SqlStore) store.SystemStore {
|
||||
func newSqlSystemStore(sqlStore SqlStore) store.SystemStore {
|
||||
s := &SqlSystemStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -26,7 +26,7 @@ func NewSqlSystemStore(sqlStore SqlStore) store.SystemStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlSystemStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlSystemStore) createIndexesIfNotExists() {
|
||||
}
|
||||
|
||||
func (s SqlSystemStore) Save(system *model.System) *model.AppError {
|
||||
|
||||
@@ -150,7 +150,7 @@ func (db teamMemberWithSchemeRolesList) ToModel() []*model.TeamMember {
|
||||
return tms
|
||||
}
|
||||
|
||||
func NewSqlTeamStore(sqlStore SqlStore) store.TeamStore {
|
||||
func newSqlTeamStore(sqlStore SqlStore) store.TeamStore {
|
||||
s := &SqlTeamStore{
|
||||
sqlStore,
|
||||
}
|
||||
@@ -175,7 +175,7 @@ func NewSqlTeamStore(sqlStore SqlStore) store.TeamStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlTeamStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlTeamStore) createIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_teams_name", "Teams", "Name")
|
||||
s.RemoveIndexIfExists("idx_teams_description", "Teams")
|
||||
s.CreateIndexIfNotExists("idx_teams_invite_id", "Teams", "InviteId")
|
||||
|
||||
@@ -17,7 +17,7 @@ type SqlTermsOfServiceStore struct {
|
||||
metrics einterfaces.MetricsInterface
|
||||
}
|
||||
|
||||
func NewSqlTermsOfServiceStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.TermsOfServiceStore {
|
||||
func newSqlTermsOfServiceStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.TermsOfServiceStore {
|
||||
s := SqlTermsOfServiceStore{sqlStore, metrics}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -30,7 +30,7 @@ func NewSqlTermsOfServiceStore(sqlStore SqlStore, metrics einterfaces.MetricsInt
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlTermsOfServiceStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlTermsOfServiceStore) createIndexesIfNotExists() {
|
||||
}
|
||||
|
||||
func (s SqlTermsOfServiceStore) Save(termsOfService *model.TermsOfService) (*model.TermsOfService, *model.AppError) {
|
||||
|
||||
@@ -16,7 +16,7 @@ type SqlTokenStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlTokenStore(sqlStore SqlStore) store.TokenStore {
|
||||
func newSqlTokenStore(sqlStore SqlStore) store.TokenStore {
|
||||
s := &SqlTokenStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -29,7 +29,7 @@ func NewSqlTokenStore(sqlStore SqlStore) store.TokenStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlTokenStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlTokenStore) createIndexesIfNotExists() {
|
||||
}
|
||||
|
||||
func (s SqlTokenStore) Save(token *model.Token) *model.AppError {
|
||||
|
||||
@@ -16,7 +16,7 @@ type SqlUserAccessTokenStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlUserAccessTokenStore(sqlStore SqlStore) store.UserAccessTokenStore {
|
||||
func newSqlUserAccessTokenStore(sqlStore SqlStore) store.UserAccessTokenStore {
|
||||
s := &SqlUserAccessTokenStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -30,7 +30,7 @@ func NewSqlUserAccessTokenStore(sqlStore SqlStore) store.UserAccessTokenStore {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlUserAccessTokenStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlUserAccessTokenStore) createIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_user_access_tokens_token", "UserAccessTokens", "Token")
|
||||
s.CreateIndexIfNotExists("idx_user_access_tokens_user_id", "UserAccessTokens", "UserId")
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func (us SqlUserStore) ClearCaches() {}
|
||||
|
||||
func (us SqlUserStore) InvalidateProfileCacheForUser(userId string) {}
|
||||
|
||||
func NewSqlUserStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.UserStore {
|
||||
func newSqlUserStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.UserStore {
|
||||
us := &SqlUserStore{
|
||||
SqlStore: sqlStore,
|
||||
metrics: metrics,
|
||||
@@ -76,7 +76,7 @@ func NewSqlUserStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) st
|
||||
return us
|
||||
}
|
||||
|
||||
func (us SqlUserStore) CreateIndexesIfNotExists() {
|
||||
func (us SqlUserStore) createIndexesIfNotExists() {
|
||||
us.CreateIndexIfNotExists("idx_users_email", "Users", "Email")
|
||||
us.CreateIndexIfNotExists("idx_users_update_at", "Users", "UpdateAt")
|
||||
us.CreateIndexIfNotExists("idx_users_create_at", "Users", "CreateAt")
|
||||
|
||||
@@ -15,7 +15,7 @@ type SqlUserTermsOfServiceStore struct {
|
||||
SqlStore
|
||||
}
|
||||
|
||||
func NewSqlUserTermsOfServiceStore(sqlStore SqlStore) store.UserTermsOfServiceStore {
|
||||
func newSqlUserTermsOfServiceStore(sqlStore SqlStore) store.UserTermsOfServiceStore {
|
||||
s := SqlUserTermsOfServiceStore{sqlStore}
|
||||
|
||||
for _, db := range sqlStore.GetAllConns() {
|
||||
@@ -27,7 +27,7 @@ func NewSqlUserTermsOfServiceStore(sqlStore SqlStore) store.UserTermsOfServiceSt
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlUserTermsOfServiceStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlUserTermsOfServiceStore) createIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_user_terms_of_service_user_id", "UserTermsOfService", "UserId")
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ type SqlWebhookStore struct {
|
||||
func (s SqlWebhookStore) ClearCaches() {
|
||||
}
|
||||
|
||||
func NewSqlWebhookStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.WebhookStore {
|
||||
func newSqlWebhookStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.WebhookStore {
|
||||
s := &SqlWebhookStore{
|
||||
SqlStore: sqlStore,
|
||||
metrics: metrics,
|
||||
@@ -55,7 +55,7 @@ func NewSqlWebhookStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s SqlWebhookStore) CreateIndexesIfNotExists() {
|
||||
func (s SqlWebhookStore) createIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_incoming_webhook_user_id", "IncomingWebhooks", "UserId")
|
||||
s.CreateIndexIfNotExists("idx_incoming_webhook_team_id", "IncomingWebhooks", "TeamId")
|
||||
s.CreateIndexIfNotExists("idx_outgoing_webhook_team_id", "OutgoingWebhooks", "TeamId")
|
||||
|
||||
Ссылка в новой задаче
Block a user