diff options
Diffstat (limited to 'store/sql_post_store.go')
-rw-r--r-- | store/sql_post_store.go | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/store/sql_post_store.go b/store/sql_post_store.go index 4a3e7e4ed..297d60397 100644 --- a/store/sql_post_store.go +++ b/store/sql_post_store.go @@ -37,11 +37,6 @@ func NewSqlPostStore(sqlStore *SqlStore) PostStore { } func (s SqlPostStore) UpgradeSchemaIfNeeded() { - - // These execs are for upgrading currently created databases to full utf8mb4 compliance - // Will be removed as seen fit for upgrading - s.GetMaster().Exec("ALTER TABLE Posts charset=utf8mb4") - s.GetMaster().Exec("ALTER TABLE Posts MODIFY COLUMN Message varchar(4000) CHARACTER SET utf8mb4") } func (s SqlPostStore) CreateIndexesIfNotExists() { @@ -293,7 +288,7 @@ func (s SqlPostStore) GetPostsSince(channelId string, time int64) StoreChannel { WHERE (UpdateAt > :Time AND ChannelId = :ChannelId) - LIMIT 100) + LIMIT 1000) UNION (SELECT * @@ -309,7 +304,7 @@ func (s SqlPostStore) GetPostsSince(channelId string, time int64) StoreChannel { WHERE UpdateAt > :Time AND ChannelId = :ChannelId - LIMIT 100) temp_tab)) + LIMIT 1000) temp_tab)) ORDER BY CreateAt DESC`, map[string]interface{}{"ChannelId": channelId, "Time": time}) @@ -321,7 +316,9 @@ func (s SqlPostStore) GetPostsSince(channelId string, time int64) StoreChannel { for _, p := range posts { list.AddPost(p) - list.AddOrder(p.Id) + if p.UpdateAt > time { + list.AddOrder(p.Id) + } } result.Data = list @@ -379,7 +376,8 @@ func (s SqlPostStore) getParentsPosts(channelId string, offset int, limit int) S ChannelId = :ChannelId1 AND DeleteAt = 0 ORDER BY CreateAt DESC - LIMIT :Limit OFFSET :Offset) q3) q1 ON q1.RootId = q2.RootId + LIMIT :Limit OFFSET :Offset) q3 + WHERE q3.RootId != '') q1 ON q1.RootId = q2.Id WHERE ChannelId = :ChannelId2 AND DeleteAt = 0 |