MCPcopy Create free account
hub / github.com/continuedev/continue / migrate

Function migrate

core/util/paths.ts:300–324  ·  view source on GitHub ↗
(
  id: string,
  callback: () => void | Promise<void>,
  onAlreadyComplete?: () => void,
)

Source from the content-addressed store, hash-verified

298}
299
300export async function migrate(
301 id: string,
302 callback: () => void | Promise<void>,
303 onAlreadyComplete?: () => void,
304) {
305 if (process.env.NODE_ENV === "test") {
306 return await Promise.resolve(callback());
307 }
308
309 const migrationsPath = getMigrationsFolderPath();
310 const migrationPath = path.join(migrationsPath, id);
311
312 if (!fs.existsSync(migrationPath)) {
313 try {
314 console.log(`Running migration: ${id}`);
315
316 fs.writeFileSync(migrationPath, "");
317 await Promise.resolve(callback());
318 } catch (e) {
319 console.warn(`Migration ${id} failed`, e);
320 }
321 } else if (onAlreadyComplete) {
322 onAlreadyComplete();
323 }
324}
325
326export function getIndexSqlitePath(): string {
327 return path.join(getIndexFolderPath(), "index.sqlite");

Callers 4

_createTablesMethod · 0.90
runLanceMigrationsFunction · 0.85
runSqliteMigrationsFunction · 0.85

Calls 3

getMigrationsFolderPathFunction · 0.85
warnMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected