MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / createDatabase

Function createDatabase

src/db/sqlite-adapter.ts:154–166  ·  view source on GitHub ↗
(dbPath: string, opts?: { readOnly?: boolean })

Source from the content-addressed store, hash-verified

152 * a process-global would race.
153 */
154export function createDatabase(dbPath: string, opts?: { readOnly?: boolean }): { db: SqliteDatabase; backend: SqliteBackend } {
155 try {
156 return { db: new NodeSqliteAdapter(dbPath, opts), backend: 'node-sqlite' };
157 } catch (error) {
158 const msg = error instanceof Error ? error.message : String(error);
159 throw new Error(
160 'Failed to open SQLite via the built-in node:sqlite module.\n' +
161 'CodeGraph requires node:sqlite (Node.js 22.5+). Install the self-contained\n' +
162 'CodeGraph release (it bundles a compatible Node), or run on Node 22.5+.\n' +
163 `Underlying error: ${msg}`
164 );
165 }
166}

Callers 4

store-worker.tsFile · 0.90
resolver-worker.tsFile · 0.90
initializeMethod · 0.90
openMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected