summaryrefslogtreecommitdiffstats
path: root/store/sqlstore
diff options
context:
space:
mode:
Diffstat (limited to 'store/sqlstore')
-rw-r--r--store/sqlstore/channel_member_history_store.go12
-rw-r--r--store/sqlstore/compliance_store.go3
-rw-r--r--store/sqlstore/post_store.go15
-rw-r--r--store/sqlstore/upgrade.go9
4 files changed, 11 insertions, 28 deletions
diff --git a/store/sqlstore/channel_member_history_store.go b/store/sqlstore/channel_member_history_store.go
index 0b86aac28..182f37ce9 100644
--- a/store/sqlstore/channel_member_history_store.go
+++ b/store/sqlstore/channel_member_history_store.go
@@ -110,8 +110,7 @@ func (s SqlChannelMemberHistoryStore) getFromChannelMemberHistoryTable(startTime
query := `
SELECT
cmh.*,
- u.Email,
- u.Username
+ u.Email
FROM ChannelMemberHistory cmh
INNER JOIN Users u ON cmh.UserId = u.Id
WHERE cmh.ChannelId = :ChannelId
@@ -131,10 +130,9 @@ func (s SqlChannelMemberHistoryStore) getFromChannelMemberHistoryTable(startTime
func (s SqlChannelMemberHistoryStore) getFromChannelMembersTable(startTime int64, endTime int64, channelId string) ([]*model.ChannelMemberHistory, error) {
query := `
SELECT DISTINCT
- ch.ChannelId,
- ch.UserId,
- u.Email,
- u.Username
+ ch.ChannelId,
+ ch.UserId,
+ u.email
FROM ChannelMembers AS ch
INNER JOIN Users AS u ON ch.UserId = u.id
WHERE ch.ChannelId = :ChannelId`
@@ -160,7 +158,7 @@ func (s SqlChannelMemberHistoryStore) PermanentDeleteBatch(endTime int64, limit
query =
`DELETE FROM ChannelMemberHistory
WHERE ctid IN (
- SELECT ctid FROM ChannelMemberHistory
+ SELECT ctid FROM ChannelMemberHistory
WHERE LeaveTime IS NOT NULL
AND LeaveTime <= :EndTime
LIMIT :Limit
diff --git a/store/sqlstore/compliance_store.go b/store/sqlstore/compliance_store.go
index 03d92d5e1..a25b01548 100644
--- a/store/sqlstore/compliance_store.go
+++ b/store/sqlstore/compliance_store.go
@@ -225,8 +225,7 @@ func (s SqlComplianceStore) MessageExport(after int64, limit int) store.StoreCha
Channels.Id AS ChannelId,
Channels.DisplayName AS ChannelDisplayName,
Users.Id AS UserId,
- Users.Email AS UserEmail,
- Users.Username
+ Users.Email AS UserEmail
FROM
Posts
LEFT OUTER JOIN Channels ON Posts.ChannelId = Channels.Id
diff --git a/store/sqlstore/post_store.go b/store/sqlstore/post_store.go
index 25c3c4913..bc336e70d 100644
--- a/store/sqlstore/post_store.go
+++ b/store/sqlstore/post_store.go
@@ -322,10 +322,7 @@ type etagPosts struct {
func (s SqlPostStore) InvalidateLastPostTimeCache(channelId string) {
lastPostTimeCache.Remove(channelId)
-
- // Keys are "{channelid}{limit}" and caching only occurs on limits of 30 and 60
- lastPostsCache.Remove(channelId + "30")
- lastPostsCache.Remove(channelId + "60")
+ lastPostsCache.Remove(channelId)
}
func (s SqlPostStore) GetEtag(channelId string, allowFromCache bool) store.StoreChannel {
@@ -442,9 +439,8 @@ func (s SqlPostStore) GetPosts(channelId string, offset int, limit int, allowFro
return
}
- // Caching only occurs on limits of 30 and 60, the common limits requested by MM clients
- if allowFromCache && offset == 0 && (limit == 60 || limit == 30) {
- if cacheItem, ok := lastPostsCache.Get(fmt.Sprintf("%s%v", channelId, limit)); ok {
+ if allowFromCache && offset == 0 && limit == 60 {
+ if cacheItem, ok := lastPostsCache.Get(channelId); ok {
if s.metrics != nil {
s.metrics.IncrementMemCacheHitCounter("Last Posts Cache")
}
@@ -486,9 +482,8 @@ func (s SqlPostStore) GetPosts(channelId string, offset int, limit int, allowFro
list.MakeNonNil()
- // Caching only occurs on limits of 30 and 60, the common limits requested by MM clients
- if offset == 0 && (limit == 60 || limit == 30) {
- lastPostsCache.AddWithExpiresInSecs(fmt.Sprintf("%s%v", channelId, limit), list, LAST_POSTS_CACHE_SEC)
+ if offset == 0 && limit == 60 {
+ lastPostsCache.AddWithExpiresInSecs(channelId, list, LAST_POSTS_CACHE_SEC)
}
result.Data = list
diff --git a/store/sqlstore/upgrade.go b/store/sqlstore/upgrade.go
index 56fdf9d6c..7c1522f25 100644
--- a/store/sqlstore/upgrade.go
+++ b/store/sqlstore/upgrade.go
@@ -15,7 +15,6 @@ import (
)
const (
- VERSION_4_8_0 = "4.8.0"
VERSION_4_7_0 = "4.7.0"
VERSION_4_6_0 = "4.6.0"
VERSION_4_5_0 = "4.5.0"
@@ -65,7 +64,6 @@ func UpgradeDatabase(sqlStore SqlStore) {
UpgradeDatabaseToVersion45(sqlStore)
UpgradeDatabaseToVersion46(sqlStore)
UpgradeDatabaseToVersion47(sqlStore)
- UpgradeDatabaseToVersion48(sqlStore)
// If the SchemaVersion is empty this this is the first time it has ran
// so lets set it to the current version.
@@ -349,10 +347,3 @@ func UpgradeDatabaseToVersion47(sqlStore SqlStore) {
saveSchemaVersion(sqlStore, VERSION_4_7_0)
}
}
-
-func UpgradeDatabaseToVersion48(sqlStore SqlStore) {
- //TODO: Uncomment the following condition when version 4.8.0 is released
- //if shouldPerformUpgrade(sqlStore, VERSION_4_7_0, VERSION_4_8_0) {
- // saveSchemaVersion(sqlStore, VERSION_4_8_0)
- //}
-}