Merge pull request #30750 from overleaf/mfb-migration-improve-handling-of-debug-projects

Create index to search for debug projects.

GitOrigin-RevId: 58c5ff47c6053f03dcd54c88d06d022fcb78d626
This commit is contained in:
Maria Florencia Besteiro Gonzalez
2026-01-26 13:52:07 +01:00
committed by Copybot
parent e9b85c4fa3
commit cee51f16ff
2 changed files with 32 additions and 0 deletions

View File

@@ -88,6 +88,7 @@ export const ProjectSchema = new Schema(
rangesSupportEnabled: { type: Boolean },
otMigrationStage: { type: Number },
},
isDebugCopyOf: { type: ObjectId },
},
collabratecUsers: [
{

View File

@@ -0,0 +1,31 @@
/* eslint-disable no-unused-vars */
import Helpers from './lib/helpers.mjs'
const tags = ['saas']
const indexes = [
{
key: { 'overleaf.isDebugCopyOf': 1, owner_ref: 1, lastUpdated: 1 },
name: 'owner_ref_1_lastUpdated_1_debugCopies',
partialFilterExpression: {
'overleaf.isDebugCopyOf': { $type: 'objectId' },
},
},
]
const migrate = async client => {
const { db } = client
await Helpers.addIndexesToCollection(db.projects, indexes)
}
const rollback = async client => {
const { db } = client
await Helpers.dropIndexesFromCollection(db.projects, indexes)
}
export default {
tags,
migrate,
rollback,
}