force_clean_fix.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --- services/web/modules/history-migration/app/src/HistoryUpgradeHelper.js
  2. +++ services/web/modules/history-migration/app/src/HistoryUpgradeHelper.js
  3. @@ -115,6 +115,11 @@ async function upgradeProject(project, options) {
  4. const projectId = project._id
  5. // delete any existing history stored in the mongo backend
  6. await HistoryManager.promises.deleteProject(projectId, projectId)
  7. + // unset overleaf.history.id to prevent the migration script from failing on checks
  8. + await db.projects.updateOne(
  9. + { _id: projectId },
  10. + { $unset: { 'overleaf.history.id': '' } }
  11. + )
  12. } catch (err) {
  13. // failed to delete existing history, but we can try to continue
  14. }
  15. --- services/web/scripts/history/migrate_history.js
  16. +++ services/web/scripts/history/migrate_history.js
  17. @@ -147,7 +147,7 @@ async function migrateProjects(projectsToMigrate) {
  18. }
  19. // send log output for each migration to a file
  20. const output = fs.createWriteStream(argv.output, { flags: 'a' })
  21. - console.log(`Writing log output to ${argv.output}`)
  22. + console.log(`Writing log output to ${process.cwd()}/${argv.output}`)
  23. const logger = new console.Console({ stdout: output })
  24. function logJson(obj) {
  25. logger.log(JSON.stringify(obj))
  26. @@ -253,8 +253,12 @@ async function main() {
  27. console.log('Projects migrated: ', projectsMigrated)
  28. console.log('Projects failed: ', projectsFailed)
  29. if (projectsFailed > 0) {
  30. - console.log(`Log output written to ${argv.output}`)
  31. - console.log('Please check the log for errors.')
  32. + console.log('------------------------------------------------------')
  33. + console.log(`Log output written to ${process.cwd()}/${argv.output}`)
  34. + console.log(
  35. + 'Please check the log for errors. Attach the content of the file when contacting support.'
  36. + )
  37. + console.log('------------------------------------------------------')
  38. }
  39. if (INTERRUPT) {
  40. console.log('Migration interrupted, please run again to continue.')