overleaf/services/web/migrations/20190912145006_create_docOps_indexes.mjs
Jakob Ackermann 5bb90dc6cb Merge pull request #21442 from overleaf/jpa-align-mongo-version
[misc] align all the mongodb dependency versions

GitOrigin-RevId: 1194fe57601af98bb61250a285bfc85b4b8179dd
2024-11-01 09:05:23 +00:00

30 lines
615 B
JavaScript

import Helpers from './lib/helpers.mjs'
import { getCollectionInternal } from '../app/src/infrastructure/mongodb.js'
const tags = ['server-ce', 'server-pro', 'saas']
const indexes = [
{
unique: true,
key: {
doc_id: 1,
},
name: 'doc_id_1',
},
]
const migrate = async () => {
const docOps = await getCollectionInternal('docOps')
await Helpers.addIndexesToCollection(docOps, indexes)
}
const rollback = async () => {
const docOps = await getCollectionInternal('docOps')
await Helpers.dropIndexesFromCollection(docOps, indexes)
}
export default {
tags,
migrate,
rollback,
}