chore(server): ignore rolled back error on the first time (#12714)
close #12692 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved error handling during migration rollbacks to better recognize and safely skip specific migration errors. - Enhanced logging for migration rollback failures to provide clearer information without interrupting the process. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -67,12 +67,18 @@ function fixFailedMigrations() {
|
|||||||
) ||
|
) ||
|
||||||
err.message.includes(
|
err.message.includes(
|
||||||
'cannot be rolled back because it was never applied'
|
'cannot be rolled back because it was never applied'
|
||||||
|
) ||
|
||||||
|
err.message.includes(
|
||||||
|
'called markMigrationRolledBack on a database without migrations table'
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
// migration has been rolled back, skip it
|
// migration has been rolled back, skip it
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw err;
|
// ignore other errors
|
||||||
|
console.log(
|
||||||
|
`migration [${migration}] rolled back failed. ${err.message}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user