Clean up direct usages of db.docHistory

Co-authored-by: Ilkin Ismailov <ilkin.ismailov@overleaf.com>
GitOrigin-RevId: 63bc36f15d85f68770bbbff5a7f64d5bc167c7f0
This commit is contained in:
Andrew Rumble
2025-10-23 12:01:03 +01:00
committed by Copybot
parent 0036ad5f31
commit e8c829deab
2 changed files with 7 additions and 5 deletions

View File

@@ -48,7 +48,8 @@ async function setAllowDowngradeToFalse() {
}
async function deleteHistoryCollections() {
await gracefullyDropCollection(db.docHistory)
const docHistory = await getCollectionInternal('docHistory')
await gracefullyDropCollection(docHistory)
await gracefullyDropCollection(db.docHistoryIndex)
const projectHistoryMetaData = await getCollectionInternal(
'projectHistoryMetaData'

View File

@@ -1,6 +1,7 @@
/* eslint-disable no-unused-vars */
import Helpers from './lib/helpers.mjs'
import { getCollectionInternal } from './lib/mongodb.mjs'
const tags = ['server-ce', 'server-pro', 'saas']
@@ -42,16 +43,16 @@ const indexes = [
]
const migrate = async client => {
const { db } = client
const docHistory = await getCollectionInternal('docHistory')
await Helpers.addIndexesToCollection(db.docHistory, indexes)
await Helpers.addIndexesToCollection(docHistory, indexes)
}
const rollback = async client => {
const { db } = client
const docHistory = await getCollectionInternal('docHistory')
try {
await Helpers.dropIndexesFromCollection(db.docHistory, indexes)
await Helpers.dropIndexesFromCollection(docHistory, indexes)
} catch (err) {
console.error('Something went wrong rolling back the migrations', err)
}