From 1ab79adb2702a85e39dd06456f4a614aa11ad3d7 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Fri, 14 Oct 2022 16:42:31 +0000 Subject: [PATCH] Ugg. Botched this trigger. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4004 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.db.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ssb.db.c b/src/ssb.db.c index f494912e..0edbf654 100644 --- a/src/ssb.db.c +++ b/src/ssb.db.c @@ -148,7 +148,6 @@ void tf_ssb_db_init(tf_ssb_t* ssb) "j.value LIKE '&%.sha256' OR " "j.value LIKE '%%%.sha256' OR " "j.value LIKE '@%.ed25519'; END"); - _tf_ssb_db_exec(db, "CREATE TRIGGER IF NOT EXISTS messages_ad_refs AFTER DELETE ON messages BEGIN DELETE FROM messages WHERE messages.id = old.message; END"); printf("Populating messages_refs...\n"); _tf_ssb_db_exec(db, "INSERT INTO messages_refs(message, ref) " "SELECT messages.id, j.value FROM messages, json_each(messages.content) as j WHERE " @@ -159,6 +158,9 @@ void tf_ssb_db_init(tf_ssb_t* ssb) printf("Done.\n"); } + _tf_ssb_db_exec(db, "DROP TRIGGER IF EXISTS messages_ad_refs"); + _tf_ssb_db_exec(db, "CREATE TRIGGER IF NOT EXISTS messages_ad_refs AFTER DELETE ON messages BEGIN DELETE FROM messages_refs WHERE messages_refs.message = old.id; END"); + bool need_add_sequence_before_author = true; bool need_convert_timestamp_to_real = false;