@agentlip/kernel 0.1.0 → 0.1.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,22 +11,31 @@ CREATE VIRTUAL TABLE IF NOT EXISTS messages_fts USING fts5(
|
|
|
11
11
|
content_rowid=rowid
|
|
12
12
|
);
|
|
13
13
|
|
|
14
|
+
-- Triggers: sync FTS with content table
|
|
15
|
+
-- Note: for external content FTS5 tables, updates/deletes must be performed via
|
|
16
|
+
-- special "delete" commands rather than UPDATE/DELETE statements.
|
|
17
|
+
|
|
18
|
+
DROP TRIGGER IF EXISTS messages_fts_insert;
|
|
19
|
+
DROP TRIGGER IF EXISTS messages_fts_update;
|
|
20
|
+
DROP TRIGGER IF EXISTS messages_fts_delete;
|
|
21
|
+
|
|
14
22
|
-- Trigger: sync FTS on insert
|
|
15
|
-
CREATE TRIGGER
|
|
23
|
+
CREATE TRIGGER messages_fts_insert AFTER INSERT ON messages
|
|
16
24
|
BEGIN
|
|
17
25
|
INSERT INTO messages_fts(rowid, content_raw) VALUES (new.rowid, new.content_raw);
|
|
18
26
|
END;
|
|
19
27
|
|
|
20
28
|
-- Trigger: sync FTS on update
|
|
21
|
-
CREATE TRIGGER
|
|
29
|
+
CREATE TRIGGER messages_fts_update AFTER UPDATE ON messages
|
|
22
30
|
BEGIN
|
|
23
|
-
|
|
31
|
+
INSERT INTO messages_fts(messages_fts, rowid, content_raw) VALUES ('delete', old.rowid, old.content_raw);
|
|
32
|
+
INSERT INTO messages_fts(rowid, content_raw) VALUES (new.rowid, new.content_raw);
|
|
24
33
|
END;
|
|
25
34
|
|
|
26
35
|
-- Trigger: sync FTS on delete
|
|
27
|
-
CREATE TRIGGER
|
|
36
|
+
CREATE TRIGGER messages_fts_delete AFTER DELETE ON messages
|
|
28
37
|
BEGIN
|
|
29
|
-
|
|
38
|
+
INSERT INTO messages_fts(messages_fts, rowid, content_raw) VALUES ('delete', old.rowid, old.content_raw);
|
|
30
39
|
END;
|
|
31
40
|
|
|
32
41
|
COMMIT;
|