overleaf-cep/services/web/migrations/20190912145019_create_projectHistoryLabels_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

42 lines
722 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',
},
{
key: {
user_id: 1,
},
name: 'user_id_1',
},
]
const migrate = async client => {
const { db } = client
await Helpers.addIndexesToCollection(db.projectHistoryLabels, indexes)
}
const rollback = async client => {
const { db } = client
try {
await Helpers.dropIndexesFromCollection(db.projectHistoryLabels, indexes)
} catch (err) {
console.error('Something went wrong rolling back the migrations', err)
}
}
export default {
tags,
migrate,
rollback,
}