overleaf-cep/services/web/migrations/20190912145018_create_projectHistoryFailures_indexes.mjs
Jakob Ackermann 54c70e9311 [web] create project-history indexes in Server Pro and CE (#23122)
GitOrigin-RevId: f361d3509037ea8b5e7af186895066a81f6b2922
2025-01-28 09:04:27 +00:00

36 lines
658 B
JavaScript

/* eslint-disable no-unused-vars */
import Helpers from './lib/helpers.mjs'
const tags = ['server-ce', 'server-pro', 'saas']
const indexes = [
{
key: {
project_id: 1,
},
name: 'project_id_1',
},
]
const migrate = async client => {
const { db } = client
await Helpers.addIndexesToCollection(db.projectHistoryFailures, indexes)
}
const rollback = async client => {
const { db } = client
try {
await Helpers.dropIndexesFromCollection(db.projectHistoryFailures, indexes)
} catch (err) {
console.error('Something went wrong rolling back the migrations', err)
}
}
export default {
tags,
migrate,
rollback,
}