Merge pull request #18906 from overleaf/em-migrate-existing-histories-2

History ranges migration script - second attempt

GitOrigin-RevId: 60a2c04e2a72e76a58e9e179fefc4186a96fde32
This commit is contained in:
Eric Mc Sween
2024-06-18 10:00:00 -04:00
committed by Copybot
parent 9d31d7e761
commit 44962fb5d7
28 changed files with 379 additions and 187 deletions
@@ -64,9 +64,11 @@ const ProjectOptionsHandler = {
return Project.updateOne(conditions, update, {})
},
async enableHistoryRangesSupport(projectId) {
async setHistoryRangesSupport(projectId, enabled) {
const conditions = { _id: new ObjectId(projectId) }
const update = { $set: { 'overleaf.history.rangesSupportEnabled': true } }
const update = {
$set: { 'overleaf.history.rangesSupportEnabled': enabled },
}
// NOTE: Updating the Mongoose model with the same query doesn't work. Maybe
// because rangesSupportEnabled is not part of the schema?
return db.projects.updateOne(conditions, update)
@@ -83,8 +85,8 @@ module.exports = {
unsetBrandVariationId: callbackify(
ProjectOptionsHandler.unsetBrandVariationId
),
enableHistoryRangesSupport: callbackify(
ProjectOptionsHandler.enableHistoryRangesSupport
setHistoryRangesSupport: callbackify(
ProjectOptionsHandler.setHistoryRangesSupport
),
promises: ProjectOptionsHandler,
}