Skip to content

Commit

Permalink
Stabilize sort for migration files (#818)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Dec 14, 2021
1 parent e2b798c commit c0082d9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ const loadMigrations = async (db: DBConnection, options: RunnerOption, logger: L
)
}),
)
).sort((m1, m2) => m1.timestamp - m2.timestamp)
).sort((m1, m2) => {
const compare = m1.timestamp - m2.timestamp
if (compare !== 0) return compare
return m1.name.localeCompare(m2.name)
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) {
throw new Error(`Can't get migration files: ${err.stack}`)
Expand Down

0 comments on commit c0082d9

Please sign in to comment.