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

Function getCurrentVersion

src/db/migrations.ts:185–195  ·  view source on GitHub ↗
(db: SqliteDatabase)

Source from the content-addressed store, hash-verified

183 * Get the current schema version from the database
184 */
185export function getCurrentVersion(db: SqliteDatabase): number {
186 try {
187 const row = db
188 .prepare('SELECT MAX(version) as version FROM schema_versions')
189 .get() as { version: number | null } | undefined;
190 return row?.version ?? 0;
191 } catch {
192 // Table doesn't exist yet
193 return 0;
194 }
195}
196
197/**
198 * Record a migration as applied

Callers 6

initializeMethod · 0.90
openMethod · 0.90
db-perf.test.tsFile · 0.90
needsMigrationFunction · 0.85
getPendingMigrationsFunction · 0.85

Calls 2

getMethod · 0.65
prepareMethod · 0.65

Tested by

no test coverage detected