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

Function getCurrentVersion

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

Source from the content-addressed store, hash-verified

156 * Get the current schema version from the database
157 */
158export function getCurrentVersion(db: SqliteDatabase): number {
159 try {
160 const row = db
161 .prepare('SELECT MAX(version) as version FROM schema_versions')
162 .get() as { version: number | null } | undefined;
163 return row?.version ?? 0;
164 } catch {
165 // Table doesn't exist yet
166 return 0;
167 }
168}
169
170/**
171 * 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