Ugg. Botched this trigger.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4004 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2022-10-14 16:42:31 +00:00
parent c7ee998b21
commit 1ab79adb27

View File

@ -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;