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:
committed by
Copybot
parent
e9b85c4fa3
commit
cee51f16ff
@@ -88,6 +88,7 @@ export const ProjectSchema = new Schema(
|
|||||||
rangesSupportEnabled: { type: Boolean },
|
rangesSupportEnabled: { type: Boolean },
|
||||||
otMigrationStage: { type: Number },
|
otMigrationStage: { type: Number },
|
||||||
},
|
},
|
||||||
|
isDebugCopyOf: { type: ObjectId },
|
||||||
},
|
},
|
||||||
collabratecUsers: [
|
collabratecUsers: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user