mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
26f3f3e2e2
Migrate scripts folder to esm 1/x GitOrigin-RevId: 4a4bc9a161f144fdb40ce3f2a0a9313b36c6df81
37 lines
741 B
JavaScript
37 lines
741 B
JavaScript
import BatchedUpdateScript from '../scripts/helpers/batchedUpdate.mjs'
|
|
const { batchedUpdate } = BatchedUpdateScript
|
|
|
|
const tags = ['saas']
|
|
|
|
const batchedUpdateOptions = {
|
|
VERBOSE_LOGGING: 'true',
|
|
BATCH_SIZE: '1',
|
|
}
|
|
|
|
const migrate = async () => {
|
|
await batchedUpdate(
|
|
'users',
|
|
{ 'twoFactorAuthentication.secret': { $exists: true } },
|
|
{ $unset: { twoFactorAuthentication: true } },
|
|
null,
|
|
null,
|
|
batchedUpdateOptions
|
|
)
|
|
}
|
|
|
|
const rollback = async () => {
|
|
await batchedUpdate(
|
|
'users',
|
|
{ 'twoFactorAuthentication.secretEncrypted': { $exists: true } },
|
|
{ $unset: { twoFactorAuthentication: true } },
|
|
null,
|
|
null,
|
|
batchedUpdateOptions
|
|
)
|
|
}
|
|
|
|
export default {
|
|
tags,
|
|
migrate,
|
|
rollback,
|
|
}
|