Fix messages_refs. Oops.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4071 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2022-12-07 23:24:31 +00:00
parent 23a6a24288
commit c2eb439574

View File

@ -144,7 +144,7 @@ void tf_ssb_db_init(tf_ssb_t* ssb)
")");
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 "
"SELECT messages.id, j.value FROM messages, json_tree(messages.content) as j WHERE "
"j.value LIKE '&%.sha256' OR "
"j.value LIKE '%%%.sha256' OR "
"j.value LIKE '@%.ed25519' "
@ -155,7 +155,7 @@ void tf_ssb_db_init(tf_ssb_t* ssb)
_tf_ssb_db_exec(db, "DROP TRIGGER IF EXISTS messages_ai_refs");
_tf_ssb_db_exec(db, "CREATE TRIGGER IF NOT EXISTS messages_ai_refs AFTER INSERT ON messages BEGIN "
"INSERT INTO messages_refs(message, ref) "
"SELECT DISTINCT new.id, j.value FROM json_each(new.content) as j WHERE "
"SELECT DISTINCT new.id, j.value FROM json_tree(new.content) as j WHERE "
"j.value LIKE '&%.sha256' OR "
"j.value LIKE '%%%.sha256' OR "
"j.value LIKE '@%.ed25519' "
@ -644,6 +644,7 @@ static int _tf_ssb_sqlite_authorizer(void* user_data, int action_code, const cha
result = (
strcmp(arg0, "blob_wants") == 0 ||
strcmp(arg0, "json_each") == 0 ||
strcmp(arg0, "json_tree") == 0 ||
strcmp(arg0, "messages") == 0 ||
strcmp(arg0, "messages_fts") == 0 ||
strcmp(arg0, "messages_fts_idx") == 0 ||