From cc1eb9b6e538279f46b173911e2ab98f2f51ef40 Mon Sep 17 00:00:00 2001 From: Andrew Rumble Date: Mon, 10 Nov 2025 13:18:03 +0000 Subject: [PATCH] Cleanup direct usages of docHistoryIndex GitOrigin-RevId: 9de5cffae3e7be053af73013ea5ac0ee8202fc54 --- .../web/scripts/history/clean_sl_history_data.mjs | 3 ++- ...90912145004_create_docHistoryIndex_indexes.mjs | 15 +++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/services/web/scripts/history/clean_sl_history_data.mjs b/services/web/scripts/history/clean_sl_history_data.mjs index 23fe136c4c..2b0435f56d 100644 --- a/services/web/scripts/history/clean_sl_history_data.mjs +++ b/services/web/scripts/history/clean_sl_history_data.mjs @@ -49,8 +49,9 @@ async function setAllowDowngradeToFalse() { async function deleteHistoryCollections() { const docHistory = await getCollectionInternal('docHistory') + const docHistoryIndex = await getCollectionInternal('docHistoryIndex') await gracefullyDropCollection(docHistory) - await gracefullyDropCollection(db.docHistoryIndex) + await gracefullyDropCollection(docHistoryIndex) const projectHistoryMetaData = await getCollectionInternal( 'projectHistoryMetaData' ) diff --git a/tools/migrations/20190912145004_create_docHistoryIndex_indexes.mjs b/tools/migrations/20190912145004_create_docHistoryIndex_indexes.mjs index 2582f12fcc..c2a40a989c 100644 --- a/tools/migrations/20190912145004_create_docHistoryIndex_indexes.mjs +++ b/tools/migrations/20190912145004_create_docHistoryIndex_indexes.mjs @@ -1,6 +1,5 @@ -/* eslint-disable no-unused-vars */ - import Helpers from './lib/helpers.mjs' +import { getCollectionInternal } from './lib/mongodb.mjs' const tags = ['server-ce', 'server-pro', 'saas'] @@ -13,17 +12,17 @@ const indexes = [ }, ] -const migrate = async client => { - const { db } = client +const migrate = async () => { + const docHistoryIndex = await getCollectionInternal('docHistoryIndex') - await Helpers.addIndexesToCollection(db.docHistoryIndex, indexes) + await Helpers.addIndexesToCollection(docHistoryIndex, indexes) } -const rollback = async client => { - const { db } = client +const rollback = async () => { + const docHistoryIndex = await getCollectionInternal('docHistoryIndex') try { - await Helpers.dropIndexesFromCollection(db.docHistoryIndex, indexes) + await Helpers.dropIndexesFromCollection(docHistoryIndex, indexes) } catch (err) { console.error('Something went wrong rolling back the migrations', err) }