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;