@@ -25,8 +25,7 @@ const createTargetTables = `
2525);
2626CREATE INDEX IF NOT EXISTS idx_target_scope_id_created_time ON target(scope_id, created_time DESC);
2727
28- -- Create a contentless FTS table as we will only use the rowids.
29- -- Note that this only creates the FTS index and cannot reference the target content
28+ -- Create a content FTS table that references the original table
3029CREATE VIRTUAL TABLE IF NOT EXISTS target_fts USING fts5(
3130 id,
3231 type,
@@ -35,7 +34,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS target_fts USING fts5(
3534 address,
3635 scope_id,
3736 created_time,
38- content='',
37+ content='target ',
3938);
4039
4140-- Create triggers to keep the FTS table in sync with the target table
@@ -68,6 +67,7 @@ CREATE TABLE IF NOT EXISTS alias (
6867 data TEXT NOT NULL
6968);
7069CREATE INDEX IF NOT EXISTS idx_alias_created_time ON alias(created_time DESC);
70+ CREATE INDEX IF NOT EXISTS idx_alias_destination_id ON alias(destination_id);
7171
7272CREATE VIRTUAL TABLE IF NOT EXISTS alias_fts USING fts5(
7373 id,
@@ -78,7 +78,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS alias_fts USING fts5(
7878 value,
7979 scope_id,
8080 created_time,
81- content='',
81+ content='alias ',
8282);
8383
8484CREATE TRIGGER IF NOT EXISTS alias_ai AFTER INSERT ON alias BEGIN
@@ -111,7 +111,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS group_fts USING fts5(
111111 description,
112112 scope_id,
113113 created_time,
114- content='',
114+ content='group ',
115115);
116116
117117CREATE TRIGGER IF NOT EXISTS group_ai AFTER INSERT ON "group" BEGIN
@@ -144,7 +144,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS role_fts USING fts5(
144144 description,
145145 scope_id,
146146 created_time,
147- content='',
147+ content='role ',
148148);
149149
150150CREATE TRIGGER IF NOT EXISTS role_ai AFTER INSERT ON role BEGIN
@@ -177,7 +177,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS user_fts USING fts5(
177177 description,
178178 scope_id,
179179 created_time,
180- content='',
180+ content='user ',
181181);
182182
183183CREATE TRIGGER IF NOT EXISTS user_ai AFTER INSERT ON user BEGIN
@@ -212,7 +212,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS credential_store_fts USING fts5(
212212 description,
213213 scope_id,
214214 created_time,
215- content='',
215+ content='credential_store ',
216216);
217217
218218CREATE TRIGGER IF NOT EXISTS credential_store_ai AFTER INSERT ON credential_store BEGIN
@@ -247,7 +247,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS scope_fts USING fts5(
247247 description,
248248 scope_id,
249249 created_time,
250- content='',
250+ content='scope ',
251251);
252252
253253CREATE TRIGGER IF NOT EXISTS scope_ai AFTER INSERT ON scope BEGIN
@@ -284,7 +284,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS auth_method_fts USING fts5(
284284 is_primary,
285285 scope_id,
286286 created_time,
287- content='',
287+ content='auth_method ',
288288);
289289
290290CREATE TRIGGER IF NOT EXISTS auth_method_ai AFTER INSERT ON auth_method BEGIN
@@ -321,7 +321,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS host_catalog_fts USING fts5(
321321 plugin_name,
322322 scope_id,
323323 created_time,
324- content='',
324+ content='host_catalog ',
325325);
326326
327327CREATE TRIGGER IF NOT EXISTS host_catalog_ai AFTER INSERT ON host_catalog BEGIN
@@ -374,7 +374,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS session_recording_fts USING fts5(
374374 target_scope_name,
375375 target_scope_parent_scope_id,
376376 created_time,
377- content='',
377+ content='session_recording ',
378378);
379379
380380CREATE TRIGGER IF NOT EXISTS session_recording_ai AFTER INSERT ON session_recording BEGIN
@@ -413,7 +413,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS session_fts USING fts5(
413413 user_id,
414414 scope_id,
415415 created_time,
416- content='',
416+ content='session ',
417417);
418418
419419CREATE TRIGGER IF NOT EXISTS session_ai AFTER INSERT ON session BEGIN
0 commit comments