MCPcopy
hub / github.com/colbymchenry/codegraph / open

Method open

src/db/index.ts:98–116  ·  view source on GitHub ↗

* Open an existing database

(dbPath: string)

Source from the content-addressed store, hash-verified

96 * Open an existing database
97 */
98 static open(dbPath: string): DatabaseConnection {
99 if (!fs.existsSync(dbPath)) {
100 throw new Error(`Database not found: ${dbPath}`);
101 }
102
103 const { db, backend } = createDatabase(dbPath);
104
105 configureConnection(db);
106
107 // Check and run migrations if needed
108 const conn = new DatabaseConnection(db, dbPath, backend);
109 const currentVersion = getCurrentVersion(db);
110
111 if (currentVersion < CURRENT_SCHEMA_VERSION) {
112 runMigrations(db, currentVersion);
113 }
114
115 return conn;
116 }
117
118 /**
119 * Get the underlying database instance

Callers 2

doInitializeMethod · 0.45
mainFunction · 0.45

Calls 4

createDatabaseFunction · 0.90
getCurrentVersionFunction · 0.90
runMigrationsFunction · 0.90
configureConnectionFunction · 0.85

Tested by

no test coverage detected