diff --git a/services/web/scripts/history/clean_sl_history_data.mjs b/services/web/scripts/history/clean_sl_history_data.mjs index 8f2bc1eab0..23fe136c4c 100644 --- a/services/web/scripts/history/clean_sl_history_data.mjs +++ b/services/web/scripts/history/clean_sl_history_data.mjs @@ -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' diff --git a/tools/migrations/20190912145005_create_docHistory_indexes.mjs b/tools/migrations/20190912145005_create_docHistory_indexes.mjs index 22d9b4ef6c..6cd6609462 100644 --- a/tools/migrations/20190912145005_create_docHistory_indexes.mjs +++ b/tools/migrations/20190912145005_create_docHistory_indexes.mjs @@ -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) }