Merge pull request #2088 from continuedev/pe/snippets-replace-into

fix: update snippets index to upsert cmds
This commit is contained in:
Patrick Erichsen 2024-08-23 09:54:58 -07:00 • committed by GitHub
commit f4bcb88896
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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],
);
}