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

Function getCurrentVersion

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

Source from the content-addressed store, hash-verified

106 * Get the current schema version from the database
107 */
108export function getCurrentVersion(db: SqliteDatabase): number {
109 try {
110 const row = db
111 .prepare('SELECT MAX(version) as version FROM schema_versions')
112 .get() as { version: number | null } | undefined;
113 return row?.version ?? 0;
114 } catch {
115 // Table doesn't exist yet
116 return 0;
117 }
118}
119
120/**
121 * Record a migration as applied

Callers 5

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