2024-10-18 07:04:57 -04:00
|
|
|
import BatchedUpdateScript from '../scripts/helpers/batchedUpdate.mjs'
|
2024-10-02 05:32:13 -04:00
|
|
|
const { batchedUpdate } = BatchedUpdateScript
|
2023-02-16 05:41:58 -05:00
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const tags = ['saas']
|
2023-02-16 05:41:58 -05:00
|
|
|
|
|
|
|
const batchedUpdateOptions = {
|
|
|
|
VERBOSE_LOGGING: 'true',
|
|
|
|
BATCH_SIZE: '1',
|
|
|
|
}
|
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const 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-02 05:32:13 -04:00
|
|
|
const rollback = async () => {
|
2023-02-16 05:41:58 -05:00
|
|
|
await batchedUpdate(
|
|
|
|
'users',
|
|
|
|
{ 'twoFactorAuthentication.secretEncrypted': { $exists: true } },
|
|
|
|
{ $unset: { twoFactorAuthentication: true } },
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
batchedUpdateOptions
|
|
|
|
)
|
|
|
|
}
|
2024-10-02 05:32:13 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
tags,
|
|
|
|
migrate,
|
|
|
|
rollback,
|
|
|
|
}
|