From 451a6e958f5062ffe8c71cdebd10a0b1dfeac177 Mon Sep 17 00:00:00 2001 From: Davinder Singh Date: Tue, 31 Oct 2023 11:02:22 +0000 Subject: [PATCH] adding DB migration for managedUserEnabled flag (#15516) GitOrigin-RevId: 82727328d6eb25bb5fe394053beb9d943cd253e9 --- .../20231030160030_managed_users_enabled.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 services/web/migrations/20231030160030_managed_users_enabled.js diff --git a/services/web/migrations/20231030160030_managed_users_enabled.js b/services/web/migrations/20231030160030_managed_users_enabled.js new file mode 100644 index 0000000000..e1a73bd058 --- /dev/null +++ b/services/web/migrations/20231030160030_managed_users_enabled.js @@ -0,0 +1,21 @@ +/* eslint-disable no-unused-vars */ + +const Helpers = require('./lib/helpers') + +exports.tags = ['saas'] + +exports.migrate = async client => { + const { db } = client + await db.subscriptions.updateMany( + { groupPolicy: { $exists: true } }, + { $set: { managedUsersEnabled: true } } + ) +} + +exports.rollback = async client => { + const { db } = client + await db.subscriptions.updateMany( + { groupPolicy: { $exists: true } }, + { $unset: { managedUsersEnabled: '' } } + ) +}