Fix for error with thread message number increment on MySQL

master
Dragory 2020-05-25 23:09:45 +03:00
parent c76d422768
commit 5c247fc73d
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
1 changed files with 3 additions and 3 deletions

View File

@ -250,9 +250,9 @@ class Thread {
* @private
*/
_lastMessageNumberInThreadSQL() {
return knex('thread_messages')
.select(knex.raw('MAX(message_number)'))
.whereRaw(`thread_messages.thread_id = '${this.id}'`)
return knex('thread_messages AS tm_msg_num_ref')
.select(knex.raw('MAX(tm_msg_num_ref.message_number)'))
.whereRaw(`tm_msg_num_ref.thread_id = '${this.id}'`)
.toSQL()
.sql;
}