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

Function getCurrentVersion

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

Source from the content-addressed store, hash-verified

222 * Get the current schema version from the database
223 */
224export function getCurrentVersion(db: SqliteDatabase): number {
225 try {
226 const row = db
227 .prepare('SELECT MAX(version) as version FROM schema_versions')
228 .get() as { version: number | null } | undefined;
229 return row?.version ?? 0;
230 } catch {
231 // Table doesn't exist yet
232 return 0;
233 }
234}
235
236/**
237 * Record a migration as applied

Callers 7

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