mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-21 03:03:40 +00:00
Merge pull request #24186 from overleaf/bg-backup-index-on-missing-lastBackedUpVersion
add a mongo index to find projects which are not backed up GitOrigin-RevId: d776ebac2bef348117dc87556156e4682ac1b3e3
This commit is contained in:
parent
a04d3198a8
commit
3cad54b215
1 changed files with 31 additions and 0 deletions
|
@ -0,0 +1,31 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
key: { 'overleaf.backup.lastBackedUpVersion': 1 },
|
||||
name: 'overleaf.backup.lastBackedUpVersion_1',
|
||||
partialFilterExpression: {
|
||||
'overleaf.backup.lastBackedUpVersion': { $in: [null] },
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
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,
|
||||
}
|
Loading…
Add table
Reference in a new issue