20241111133330_remove_null_managed_users_sso_from_subscriptions.mjs 521 B

12345678910111213141516171819202122232425
  1. import { batchedUpdate } from '@overleaf/mongo-utils/batchedUpdate.js'
  2. const tags = ['saas']
  3. const migrate = async client => {
  4. const { db } = client
  5. await batchedUpdate(
  6. db.subscriptions,
  7. { 'features.managedUsers': { $eq: null } },
  8. { $set: { 'features.managedUsers': true } }
  9. )
  10. await batchedUpdate(
  11. db.subscriptions,
  12. { 'features.groupSSO': { $eq: null } },
  13. { $set: { 'features.groupSSO': true } }
  14. )
  15. }
  16. const rollback = async () => {}
  17. export default {
  18. tags,
  19. migrate,
  20. rollback,
  21. }