diff --git a/src/migration.ts b/src/migration.ts index 25c672e5..f131f8b0 100644 --- a/src/migration.ts +++ b/src/migration.ts @@ -128,9 +128,16 @@ export async function getMigrationFilePaths( const globMatches = await glob(dir, { ignore: ignorePattern, nodir: true, - absolute: true, + withFileTypes: true, }); - return globMatches.sort(localeCompareStringsNumerically); + + return globMatches + .sort( + (a, b) => + compareFileNamesByTimestamp(a.name, b.name, logger) || + localeCompareStringsNumerically(a.name, b.name) + ) + .map((pathScurry) => pathScurry.fullpath()); } if (Array.isArray(dir) || Array.isArray(ignorePattern)) {