Skip to content

Commit 552e5b3

Browse files
authored
fix: db sorting past 200 messages (#3018)
* fix: db sorting past 200 messages * chore: remove console.log
1 parent 9042015 commit 552e5b3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

package/src/store/apis/queries/selectMessagesForChannels.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@ export const selectMessagesForChannels = async (
3030
*,
3131
ROW_NUMBER() OVER (
3232
PARTITION BY cid
33-
ORDER BY cast(strftime('%s', createdAt) AS INTEGER) ASC
33+
ORDER BY cast(strftime('%s', createdAt) AS INTEGER) DESC
3434
) RowNum
3535
FROM messages
3636
WHERE cid in (${questionMarks})
3737
) a
3838
LEFT JOIN
3939
users b
4040
ON b.id = a.userId
41-
WHERE RowNum < 200`,
41+
WHERE RowNum < 200
42+
ORDER BY cast(strftime('%s', a.createdAt) AS INTEGER) ASC`,
4243
cids,
4344
);
4445

0 commit comments

Comments
 (0)