This commit is contained in:
2023-09-04 18:43:32 -05:00
parent 84a017281f
commit 9f65ad172c
3 changed files with 8 additions and 4 deletions

View File

@ -43,12 +43,12 @@ func (mq *MessageQuery) New() *Message {
const (
getAllMessagesSelect = `
SELECT chat_gmid, chat_receiver, gmid, mxid, sender, timestamp, sent
FROM messages
FROM message
`
getAllMessagesQuery = getAllMessagesSelect + `
WHERE chat_gmid=$1 AND chat_receiver=$2
`
getByGMIDQuery = getAllMessagesQuery + "AND jid=$3"
getByGMIDQuery = getAllMessagesQuery + "AND gmid=$3"
getByMXIDQuery = getAllMessagesSelect + "WHERE mxid=$1"
getLastMessageInChatQuery = getAllMessagesQuery + `
AND timestamp<=$3 AND sent=true