diff --git a/src/ssb.db.c b/src/ssb.db.c index 8fc128ef..5b0c343e 100644 --- a/src/ssb.db.c +++ b/src/ssb.db.c @@ -174,13 +174,15 @@ void tf_ssb_db_init(tf_ssb_t* ssb) _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_refs_message_idx ON messages_refs (message)"); _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_refs_ref_idx ON messages_refs (ref)"); + _tf_ssb_db_exec(db, "DROP VIEW IF EXISTS blob_wants_view"); _tf_ssb_db_exec(db, "CREATE VIEW IF NOT EXISTS blob_wants_view (id) AS " " SELECT messages_refs.ref AS id " " FROM messages_refs " " LEFT OUTER JOIN blobs ON messages_refs.ref = blobs.id " - " WHERE messages_refs.ref LIKE '&____________________________________________.sha256' " - " AND blobs.id IS NULL"); + " WHERE blobs.id IS NULL " + " AND LENGTH(messages_refs.ref) = 52 " + " AND messages_refs.ref LIKE '&%.sha256'"); bool need_add_sequence_before_author = true; bool need_convert_timestamp_to_real = false;