| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
CREATE VIRTUAL TABLE IF NOT EXISTS feed_items_fts USING fts5( |
| 5 |
title, |
| 6 |
body, |
| 7 |
bite_text, |
| 8 |
content='feed_items', |
| 9 |
content_rowid='rowid' |
| 10 |
); |
| 11 |
|
| 12 |
|
| 13 |
INSERT INTO feed_items_fts(rowid, title, body, bite_text) |
| 14 |
SELECT rowid, COALESCE(title, ''), COALESCE(body, ''), bite_text FROM feed_items; |
| 15 |
|
| 16 |
|
| 17 |
CREATE TRIGGER feed_items_fts_insert AFTER INSERT ON feed_items BEGIN |
| 18 |
INSERT INTO feed_items_fts(rowid, title, body, bite_text) |
| 19 |
VALUES (NEW.rowid, COALESCE(NEW.title, ''), COALESCE(NEW.body, ''), NEW.bite_text); |
| 20 |
END; |
| 21 |
|
| 22 |
|
| 23 |
CREATE TRIGGER feed_items_fts_update AFTER UPDATE ON feed_items BEGIN |
| 24 |
INSERT INTO feed_items_fts(feed_items_fts, rowid, title, body, bite_text) |
| 25 |
VALUES ('delete', OLD.rowid, COALESCE(OLD.title, ''), COALESCE(OLD.body, ''), OLD.bite_text); |
| 26 |
INSERT INTO feed_items_fts(rowid, title, body, bite_text) |
| 27 |
VALUES (NEW.rowid, COALESCE(NEW.title, ''), COALESCE(NEW.body, ''), NEW.bite_text); |
| 28 |
END; |
| 29 |
|
| 30 |
|
| 31 |
CREATE TRIGGER feed_items_fts_delete AFTER DELETE ON feed_items BEGIN |
| 32 |
INSERT INTO feed_items_fts(feed_items_fts, rowid, title, body, bite_text) |
| 33 |
VALUES ('delete', OLD.rowid, COALESCE(OLD.title, ''), COALESCE(OLD.body, ''), OLD.bite_text); |
| 34 |
END; |
| 35 |
|