core: Add backlog trigger to update lastmsgid
[quassel.git] / src / core / SQL / SQLite / version / 22 / upgrade_001_add_trigger_backlog_lastmsgid_update_direct_update.sql
1 CREATE TRIGGER IF NOT EXISTS backlog_lastmsgid_update_trigger_update
2 AFTER UPDATE
3 ON backlog
4 FOR EACH ROW
5     BEGIN
6         UPDATE buffer
7         SET lastmsgid = new.messageid
8         WHERE buffer.bufferid = new.bufferid
9             AND buffer.lastmsgid < new.messageid;
10     END