From 676f0d9335df7bf7f42aae3434847cc0032c3c0a Mon Sep 17 00:00:00 2001 From: Test Date: Fri, 23 Aug 2024 09:54:19 -0700 Subject: [PATCH] fix: update snippets index to upsert cmds --- core/indexing/CodeSnippetsIndex.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/indexing/CodeSnippetsIndex.ts b/core/indexing/CodeSnippetsIndex.ts index 3ef21f3d7..dc55f9cc3 100644 --- a/core/indexing/CodeSnippetsIndex.ts +++ b/core/indexing/CodeSnippetsIndex.ts @@ -217,7 +217,7 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { for (const snippet of snippets) { const { lastID } = await db.run( - "INSERT INTO code_snippets (path, cacheKey, content, title, startLine, endLine) VALUES (?, ?, ?, ?, ?, ?)", + "REPLACE INTO code_snippets (path, cacheKey, content, title, startLine, endLine) VALUES (?, ?, ?, ?, ?, ?)", [ addTag.path, addTag.cacheKey, @@ -228,7 +228,7 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { ], ); await db.run( - "INSERT INTO code_snippets_tags (snippetId, tag) VALUES (?, ?)", + "REPLACE INTO code_snippets_tags (snippetId, tag) VALUES (?, ?)", [lastID, tagString], ); }