mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-27 09:33:55 +00:00
[web] add migration for indexing onboardingDataCollection.updatedAt (#22918)
Co-authored-by: Dr. Sasha Göbbels <sasha.goebbels@overleaf.com> GitOrigin-RevId: 6dbd3e994dc3ebc3ef9afd6d3e3efe00606ba127
This commit is contained in:
parent
c0caaa20c3
commit
cebaebc356
1 changed files with 30 additions and 0 deletions
|
@ -0,0 +1,30 @@
|
|||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
const tags = ['saas']
|
||||
|
||||
const index = {
|
||||
key: { updatedAt: 1 },
|
||||
name: 'updatedAt_1',
|
||||
}
|
||||
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.onboardingDataCollection, [index])
|
||||
}
|
||||
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
try {
|
||||
await Helpers.dropIndexesFromCollection(db.onboardingDataCollection, [
|
||||
index,
|
||||
])
|
||||
} catch (err) {
|
||||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
Loading…
Add table
Reference in a new issue