what2watch/migrations/20240203053645_fts.up.sql

17 lines
1,007 B
MySQL
Raw Permalink Normal View History

2024-02-03 23:04:05 +00:00
create virtual table if not exists star_search using fts5 (name, id UNINDEXED, tokenize = 'trigram', content = 'stars', content_rowid=rowid);
create trigger if not exists stars_update_search after insert on stars begin
insert into star_search (rowid, name, id) values (new.rowid, new.name, new.id);
end;
create trigger if not exists stars_delete_search after delete on stars begin
insert into star_search (star_search, rowid, name, id) values ('delete', old.rowid, old.name, old.id);
end;
create virtual table if not exists watch_search using fts5 (title, id UNINDEXED, tokenize = 'trigram', content = 'watches', content_rowid=rowid);
create trigger if not exists watches_update_search after insert on watches begin
insert into watch_search (rowid, title, id) values (new.rowid, new.title, new.id);
end;
create trigger if not exists watches_delete_search after delete on watches begin
insert into watch_search (watch_search, rowid, title, id) values ('delete', old.rowid, old.title, old.id);
end;
2024-02-03 05:47:50 +00:00