Merge pull request #11490 from overleaf/msm-migrate-history-fix

[web/scripts] `history/migrate_history.js` fixes

GitOrigin-RevId: 249e9a3f1dbf89d46335ee208f5922905477845c
This commit is contained in:
Miguel Serrano
2023-01-27 12:04:01 +00:00
committed by Copybot
parent a87d44ffdd
commit 6787e9c50d
8 changed files with 1723 additions and 4 deletions
@@ -5,6 +5,7 @@ const {
countProjects,
countDocHistory,
upgradeProject,
findProjects,
} = require('../../modules/history-migration/app/src/HistoryUpgradeHelper')
const { waitForDb } = require('../../app/src/infrastructure/mongodb')
const minimist = require('minimist')
@@ -50,7 +51,7 @@ async function findProjectsToMigrate() {
}
// Get a list of projects to migrate
const projectsToMigrate = findProjectsToMigrate(
const projectsToMigrate = await findProjects(
{ 'overleaf.history.display': { $ne: true } },
{ _id: 1, overleaf: 1 }
)
@@ -108,6 +109,7 @@ async function main() {
process.exit(0)
}
await migrateProjects(projectsToMigrate)
console.log('Done.')
}
waitForDb()
@@ -20,7 +20,7 @@ const { ReadPreference, ObjectId } = require('mongodb')
const { db, waitForDb } = require('../../app/src/infrastructure/mongodb')
const { promiseMapWithLimit } = require('../../app/src/util/promises')
const { batchedUpdate } = require('../helpers/batchedUpdate')
const ProjectHistoryController = require('../../modules/admin-panel/app/src/ProjectHistoryController')
const ProjectHistoryController = require('../../modules/history-migration/app/src/ProjectHistoryController')
console.log({
DRY_RUN,