Remove unnecessary trigger
This commit is contained in:
parent
8a28ba7b6e
commit
f17d4459d1
1 changed files with 1 additions and 12 deletions
|
|
@ -65,9 +65,7 @@ pub fn prepare(conn: &mut Connection) -> rusqlite::Result<()> {
|
||||||
",
|
",
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Cache amount of unseen messages per room because counting them takes far
|
// Cache amount of unseen messages per room.
|
||||||
// too long. Uses triggers to move as much of the updating logic as possible
|
|
||||||
// into SQLite.
|
|
||||||
conn.execute_batch(
|
conn.execute_batch(
|
||||||
"
|
"
|
||||||
CREATE TEMPORARY TABLE euph_unseen_counts (
|
CREATE TEMPORARY TABLE euph_unseen_counts (
|
||||||
|
|
@ -119,15 +117,6 @@ pub fn prepare(conn: &mut Connection) -> rusqlite::Result<()> {
|
||||||
SET amount = CASE WHEN new.seen THEN amount - 1 ELSE amount + 1 END
|
SET amount = CASE WHEN new.seen THEN amount - 1 ELSE amount + 1 END
|
||||||
WHERE room = new.room;
|
WHERE room = new.room;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
CREATE TEMPORARY TRIGGER euc_delete_msg
|
|
||||||
AFTER DELETE ON main.euph_msgs
|
|
||||||
WHEN NOT old.seen
|
|
||||||
BEGIN
|
|
||||||
UPDATE euph_unseen_counts
|
|
||||||
SET amount = amount - 1
|
|
||||||
WHERE room = old.room;
|
|
||||||
END;
|
|
||||||
",
|
",
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue