Files
overleaf-cep/tools/migrations/20260820120000_create_workspaces_subscription_id_index.mjs
T
ilkin-overleaf b4b12caf48 Merge pull request #36833 from overleaf/ii-workspaces-collection
[web] Create workspaces collection indexes

GitOrigin-RevId: a84d404e660e6c19eb288712bcf020e1ba4a90d0
2026-09-17 12:05:51 +00:00

30 lines
711 B
JavaScript

import Helpers from './lib/helpers.mjs'
const tags = ['saas', 'nonblocking']
// Every read and write of a workspace looks it up by the subscription that owns
// it, so this backs the group settings page. Not unique: a subscription is
// allowed several workspaces, even though a group currently gets exactly one.
const indexes = [
{
key: { subscription_id: 1 },
name: 'subscription_id_1',
},
]
const migrate = async client => {
const { db } = client
await Helpers.addIndexesToCollection(db.workspaces, indexes)
}
const rollback = async client => {
const { db } = client
await Helpers.dropIndexesFromCollection(db.workspaces, indexes)
}
export default {
tags,
migrate,
rollback,
}