MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / openWritableDb

Function openWritableDb

apps/desktop/main/worker/query/fts.ts:20–29  ·  view source on GitHub ↗
(sessionId: string)

Source from the content-addressed store, hash-verified

18import { getDbPath, openDatabase } from '../core'
19
20function openWritableDb(sessionId: string): Database.Database | null {
21 const dbPath = getDbPath(sessionId)
22 try {
23 const db = new Database(dbPath)
24 db.pragma('journal_mode = WAL')
25 return db
26 } catch {
27 return null
28 }
29}
30
31export function hasFtsIndex(sessionId: string): boolean {
32 const db = openDatabase(sessionId)

Callers 3

buildFtsIndexFunction · 0.85
rebuildFtsIndexFunction · 0.85
insertFtsEntriesFunction · 0.85

Calls 2

getDbPathFunction · 0.90
pragmaMethod · 0.65

Tested by

no test coverage detected