Fix incorrect order of migrations when reverting (#12130)

This commit is contained in:
ian
2022-03-22 02:29:15 +08:00
committed by GitHub
parent 72180f7027
commit ff3c99961c

View File

@@ -74,7 +74,7 @@ export default async function run(database: Knex, direction: 'up' | 'down' | 'la
}
async function down() {
const lastAppliedMigration = orderBy(completedMigrations, ['timestamp'], ['desc'])[0];
const lastAppliedMigration = orderBy(completedMigrations, ['timestamp', 'version'], ['desc', 'desc'])[0];
if (!lastAppliedMigration) {
throw Error('Nothing to downgrade');