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

Function runMigrations

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

Source from the content-addressed store, hash-verified

130 * Run all pending migrations
131 */
132export function runMigrations(db: SqliteDatabase, fromVersion: number): void {
133 const pending = migrations.filter((m) => m.version > fromVersion);
134
135 if (pending.length === 0) {
136 return;
137 }
138
139 // Sort by version
140 pending.sort((a, b) => a.version - b.version);
141
142 // Run each migration in a transaction
143 for (const migration of pending) {
144 db.transaction(() => {
145 migration.up(db);
146 recordMigration(db, migration.version, migration.description);
147 })();
148 }
149}
150
151/**
152 * 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