Merge pull request #11641 from overleaf/bg-improve-migration-script

improve history migration script

GitOrigin-RevId: bd1b4263ccb3d10f0c9d741e4f11671cf307cd58
This commit is contained in:
Miguel Serrano
2023-02-07 09:54:58 +00:00
committed by Copybot
parent 23ef040d92
commit f8bc3b3357
3 changed files with 103 additions and 9 deletions
@@ -18,12 +18,12 @@ const DATETIME_WHEN_FULL_PROJECT_HISTORY_ENABLED =
: null
async function countProjects(query = {}) {
const count = await db.projects.count(query)
const count = await db.projects.countDocuments(query)
return count
}
async function countDocHistory(query = {}) {
const count = await db.docHistory.count(query)
const count = await db.docHistory.countDocuments(query)
return count
}
@@ -1295,11 +1295,11 @@ async function migrateProjectHistory(projectId, options = {}) {
throw error
}
}
// set the display to v2 history
logger.debug(
{ projectId },
'Switching on full project history display for project'
)
// Set the display to v2 history but allow downgrading (second argument allowDowngrade = true)
await ProjectHistoryHandler.promises.upgradeHistory(projectId, true)
} catch (error) {
// delete the history id again if something failed?