2024-10-01 05:53:36 -04:00
|
|
|
const { batchedUpdate } = require('../scripts/helpers/batchedUpdate')
|
2023-02-16 05:41:58 -05:00
|
|
|
|
2024-10-01 05:53:36 -04:00
|
|
|
exports.tags = ['saas']
|
2023-02-16 05:41:58 -05:00
|
|
|
|
|
|
|
const batchedUpdateOptions = {
|
|
|
|
VERBOSE_LOGGING: 'true',
|
|
|
|
BATCH_SIZE: '1',
|
|
|
|
}
|
|
|
|
|
2024-10-01 05:53:36 -04:00
|
|
|
exports.migrate = async () => {
|
2023-02-16 05:41:58 -05:00
|
|
|
await batchedUpdate(
|
|
|
|
'users',
|
|
|
|
{ 'twoFactorAuthentication.secret': { $exists: true } },
|
|
|
|
{ $unset: { twoFactorAuthentication: true } },
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
batchedUpdateOptions
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-10-01 05:53:36 -04:00
|
|
|
exports.rollback = async () => {
|
2023-02-16 05:41:58 -05:00
|
|
|
await batchedUpdate(
|
|
|
|
'users',
|
|
|
|
{ 'twoFactorAuthentication.secretEncrypted': { $exists: true } },
|
|
|
|
{ $unset: { twoFactorAuthentication: true } },
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
batchedUpdateOptions
|
|
|
|
)
|
|
|
|
}
|