Merge pull request #23368 from overleaf/bg-add-index-for-pending-change-at

add migration for creating index on overleaf.backup.pendingChangeAt

GitOrigin-RevId: b15f1b95d8dbbb08cd2ae4863a0501663130ab65
This commit is contained in:
Brian Gough
2025-02-05 09:06:50 +00:00
committed by Copybot
parent c53a00eb48
commit 9b073db24d
@@ -0,0 +1,31 @@
/* eslint-disable no-unused-vars */
import Helpers from './lib/helpers.mjs'
const tags = ['saas']
const indexes = [
{
key: { 'overleaf.backup.pendingChangeAt': 1 },
name: 'overleaf_backup_pendingChangeAt_1',
partialFilterExpression: {
'overleaf.backup.pendingChangeAt': { $exists: true },
},
},
]
const migrate = async client => {
const { db } = client
await Helpers.addIndexesToCollection(db.projects, indexes)
}
const rollback = async client => {
const { db } = client
await Helpers.dropIndexesFromCollection(db.projects, indexes)
}
export default {
tags,
migrate,
rollback,
}