mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-08 08:39:03 +02:00
Add migration for drop projectHistoryMetaData collection
GitOrigin-RevId: 1ebfc60ee9591837f37e507fb1dcb059c09a7f3b
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
import mongodb from '../app/src/infrastructure/mongodb.js'
|
||||
|
||||
const tags = ['saas']
|
||||
|
||||
@@ -13,17 +14,19 @@ const indexes = [
|
||||
},
|
||||
]
|
||||
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.projectHistoryMetaData, indexes)
|
||||
const migrate = async () => {
|
||||
await Helpers.addIndexesToCollection(
|
||||
await mongodb.getCollectionInternal('projectHistoryMetaData'),
|
||||
indexes
|
||||
)
|
||||
}
|
||||
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
const rollback = async () => {
|
||||
try {
|
||||
await Helpers.dropIndexesFromCollection(db.projectHistoryMetaData, indexes)
|
||||
await Helpers.dropIndexesFromCollection(
|
||||
await mongodb.getCollectionInternal('projectHistoryMetaData'),
|
||||
indexes
|
||||
)
|
||||
} catch (err) {
|
||||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
const tags = ['saas']
|
||||
|
||||
const migrate = async () => {
|
||||
await Helpers.dropCollection('projectHistoryMetaData')
|
||||
}
|
||||
|
||||
const rollback = async () => {
|
||||
// Can't really do anything here
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
||||
Reference in New Issue
Block a user