Merge pull request #36833 from overleaf/ii-workspaces-collection

[web] Create workspaces collection indexes

GitOrigin-RevId: a84d404e660e6c19eb288712bcf020e1ba4a90d0
This commit is contained in:
ilkin-overleaf
2026-09-17 12:05:51 +00:00
committed by Copybot
parent 09c564fbc4
commit b4b12caf48
4 changed files with 58 additions and 0 deletions
@@ -0,0 +1,29 @@
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,
}
+1
View File
@@ -74,6 +74,7 @@ export const db = {
tokens: internalDb.collection('tokens'),
userAuditLogEntries: internalDb.collection('userAuditLogEntries'),
users: internalDb.collection('users'),
workspaces: internalDb.collection('workspaces'),
onboardingDataCollection: internalDb.collection('onboardingDataCollection'),
scriptLogs: internalDb.collection('scriptLogs'),
}