From df3aff9c66e2ba7319fc11eb708e690afc806b28 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Thu, 2 Feb 2023 16:12:40 +0100 Subject: [PATCH] Merge pull request #11629 from overleaf/msm-exit-migrate-history [web/scripts] force exit on `migrate_history.js` GitOrigin-RevId: 298568043c2885b8ad2c6242e7519faccf2f2498 --- services/web/scripts/history/migrate_history.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/services/web/scripts/history/migrate_history.js b/services/web/scripts/history/migrate_history.js index a38ac79dfb..624f1cdbe0 100644 --- a/services/web/scripts/history/migrate_history.js +++ b/services/web/scripts/history/migrate_history.js @@ -100,11 +100,7 @@ async function migrateProjects(projectsToMigrate) { console.error(err) } } - - console.log('Migration complete') - console.log('==================') - console.log('Projects migrated: ', projectsMigrated) - console.log('Projects failed: ', projectsFailed) + return { projectsMigrated, projectsFailed } } async function main() { @@ -113,8 +109,15 @@ async function main() { console.log('Dry run, exiting') process.exit(0) } - await migrateProjects(projectsToMigrate) + const { projectsMigrated, projectsFailed } = await migrateProjects( + projectsToMigrate + ) + console.log('Migration complete') + console.log('==================') + console.log('Projects migrated: ', projectsMigrated) + console.log('Projects failed: ', projectsFailed) console.log('Done.') + process.exit(projectsFailed > 0 ? 1 : 0) } waitForDb()