MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / discoverMigrations

Function discoverMigrations

packages/core/src/utils/AbstractMigrator.ts:531–552  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

529 }
530
531 protected async discoverMigrations(): Promise<RunnableMigration[]> {
532 if (this.options.migrationsList) {
533 return this.options.migrationsList.map(migration => {
534 if (typeof migration === 'function') {
535 return this.initialize(migration, migration.name);
536 }
537
538 return this.initialize(migration.class, migration.name);
539 });
540 }
541
542 const { fs } = await import('@mikro-orm/core/fs-utils');
543 const pattern = fs.normalizePath(this.absolutePath, this.options.glob!);
544 const files: string[] = fs.glob(pattern).sort();
545
546 return files.map(filePath =>
547 this.resolve({
548 name: filePath.replace(/\\/g, '/').split('/').pop()!,
549 path: filePath,
550 }),
551 );
552 }
553
554 private async executeMigrations(
555 method: 'up' | 'down',

Callers

nothing calls this directly

Calls 4

normalizePathMethod · 0.80
sortMethod · 0.80
globMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected