feat: mentions in lives_with and text_body fields
Some checks failed
/ integration-test--firefox (push) Failing after 3m7s

This commit is contained in:
Robert Perce 2026-01-26 15:25:45 -06:00
parent fd5f1899c1
commit d42adbe274
10 changed files with 369 additions and 200 deletions

View file

@ -0,0 +1,30 @@
create table if not exists mentions (
entity_id integer not null,
entity_type integer not null,
url text not null,
input_text text not null,
byte_range_start integer not null,
byte_range_end integer not null
);
insert into mentions (
entity_id, url, input_text, byte_range_start, byte_range_end, entity_type)
select entry_id, url, input_text, byte_range_start, byte_range_end, 'journal_entry'
from journal_mentions;
drop table journal_mentions;
-- entity types:
-- 0: journal_entry
-- 1: contact.text_body
-- 2: contact.lives_with
create trigger if not exists cascade_delete_journal_mentions
after delete on journal_entries for each row begin
delete from mentions where entity_type = 0 and entity_id = OLD.id;
end;
create trigger if not exists cascade_delete_contact_text_body_mentions
after delete on contacts for each row begin
delete from mentions where entity_type = 1 and entity_id = OLD.id;
delete from mentions where entity_type = 2 and entity_id = OLD.id;
end;