diff --git a/src/ssb.db.c b/src/ssb.db.c index 6ab7c4ab..5cb07c95 100644 --- a/src/ssb.db.c +++ b/src/ssb.db.c @@ -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 ||