diff --git a/Web/Models/sql/read-messages.tsql b/Web/Models/sql/read-messages.tsql new file mode 100644 index 00000000..15f20728 --- /dev/null +++ b/Web/Models/sql/read-messages.tsql @@ -0,0 +1,20 @@ +UPDATE + `messages` +SET + `unread` = 0 +WHERE + (`id` > ?) + AND ( + ( + (`sender_type` = ?) + AND (`recipient_type` = ?) + AND (`sender_id` = ?) + AND (`recipient_id` = ?) + ) + OR ( + (`sender_type` = ?) + AND (`recipient_type` = ?) + AND (`sender_id` = ?) + AND (`recipient_id` = ?) + ) + )