mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-23 23:00:08 +02:00

[web] add migration for fixing collaborator arrays on projects GitOrigin-RevId: 73178b56501025bf23f463e8f9822fc33ecaaea0
29 lines
596 B
JavaScript
29 lines
596 B
JavaScript
import { batchedUpdate } from '@overleaf/mongo-utils/batchedUpdate.js'
|
|
import { db } from '../app/src/infrastructure/mongodb.js'
|
|
|
|
const tags = ['server-ce', 'server-pro', 'saas']
|
|
|
|
const migrate = async () => {
|
|
const fields = [
|
|
'collaberator_refs',
|
|
'pendingEditor_refs',
|
|
'pendingReviewer_refs',
|
|
'readOnly_refs',
|
|
'reviewer_refs',
|
|
]
|
|
for (const field of fields) {
|
|
await batchedUpdate(
|
|
db.projects,
|
|
{ [field]: { $type: 'null' } },
|
|
{ $set: { [field]: [] } }
|
|
)
|
|
}
|
|
}
|
|
|
|
const rollback = async () => {}
|
|
|
|
export default {
|
|
tags,
|
|
migrate,
|
|
rollback,
|
|
}
|