mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-13 21:53:43 +01:00
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:
@@ -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,
|
||||
}
|
||||
Reference in New Issue
Block a user