From 357276b599bd631f4a3c1cf63f63b886015ab9a0 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 6 Dec 2019 12:09:51 -0500 Subject: Add eventsDelete trigger --- database.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/database.h b/database.h index 038ce70..2481262 100644 --- a/database.h +++ b/database.h @@ -177,7 +177,6 @@ static const char *InitSQL = { "target TEXT," "message TEXT" ");" - // TODO: Create other indexes on events? "CREATE VIRTUAL TABLE search USING fts5 (" "message," "content = events," @@ -187,6 +186,10 @@ static const char *InitSQL = { "CREATE TRIGGER eventsInsert AFTER INSERT ON events BEGIN" " INSERT INTO search (rowid, message) VALUES (new.id, new.message);" "END;" + "CREATE TRIGGER eventsDelete AFTER DELETE ON events BEGIN" + " INSERT INTO search (search, rowid, message)" + " VALUES ('delete', old.id, old.message);" + "END;" "COMMIT TRANSACTION;" }; -- cgit 1.4.1