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

Function runMigrations

src/db/migrations.ts:182–199  ·  view source on GitHub ↗
(db: SqliteDatabase, fromVersion: number)

Source from the content-addressed store, hash-verified

180 * Run all pending migrations
181 */
182export function runMigrations(db: SqliteDatabase, fromVersion: number): void {
183 const pending = migrations.filter((m) => m.version > fromVersion);
184
185 if (pending.length === 0) {
186 return;
187 }
188
189 // Sort by version
190 pending.sort((a, b) => a.version - b.version);
191
192 // Run each migration in a transaction
193 for (const migration of pending) {
194 db.transaction(() => {
195 migration.up(db);
196 recordMigration(db, migration.version, migration.description);
197 })();
198 }
199}
200
201/**
202 * Check if the database needs migration

Callers 2

openMethod · 0.90
db-perf.test.tsFile · 0.90

Calls 2

recordMigrationFunction · 0.85
transactionMethod · 0.65

Tested by

no test coverage detected