Cleanup direct usages of docHistoryIndex
GitOrigin-RevId: 9de5cffae3e7be053af73013ea5ac0ee8202fc54
This commit is contained in:
@@ -49,8 +49,9 @@ async function setAllowDowngradeToFalse() {
|
|||||||
|
|
||||||
async function deleteHistoryCollections() {
|
async function deleteHistoryCollections() {
|
||||||
const docHistory = await getCollectionInternal('docHistory')
|
const docHistory = await getCollectionInternal('docHistory')
|
||||||
|
const docHistoryIndex = await getCollectionInternal('docHistoryIndex')
|
||||||
await gracefullyDropCollection(docHistory)
|
await gracefullyDropCollection(docHistory)
|
||||||
await gracefullyDropCollection(db.docHistoryIndex)
|
await gracefullyDropCollection(docHistoryIndex)
|
||||||
const projectHistoryMetaData = await getCollectionInternal(
|
const projectHistoryMetaData = await getCollectionInternal(
|
||||||
'projectHistoryMetaData'
|
'projectHistoryMetaData'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
|
||||||
|
|
||||||
import Helpers from './lib/helpers.mjs'
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
import { getCollectionInternal } from './lib/mongodb.mjs'
|
||||||
|
|
||||||
const tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
@@ -13,17 +12,17 @@ const indexes = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const migrate = async client => {
|
const migrate = async () => {
|
||||||
const { db } = client
|
const docHistoryIndex = await getCollectionInternal('docHistoryIndex')
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.docHistoryIndex, indexes)
|
await Helpers.addIndexesToCollection(docHistoryIndex, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
const rollback = async client => {
|
const rollback = async () => {
|
||||||
const { db } = client
|
const docHistoryIndex = await getCollectionInternal('docHistoryIndex')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await Helpers.dropIndexesFromCollection(db.docHistoryIndex, indexes)
|
await Helpers.dropIndexesFromCollection(docHistoryIndex, indexes)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user