From 8675a7d31755835ffc5a5f33586044d1765b483a Mon Sep 17 00:00:00 2001 From: Rish Date: Mon, 6 Jul 2020 11:02:25 +0530 Subject: [PATCH] Updated portal button setting to false no issue - Existing and new sites should have portal button hidden by default and need explicit switch on from Admin. - Default value for new sites has been updated, but existing sites still have old default and portal button set as true - Migration here resets portal button setting to false for all existing sites, and they'll need to be explicitly turn it on from admin again --- .../3.23/03-update-portal-button-setting.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 core/server/data/migrations/versions/3.23/03-update-portal-button-setting.js diff --git a/core/server/data/migrations/versions/3.23/03-update-portal-button-setting.js b/core/server/data/migrations/versions/3.23/03-update-portal-button-setting.js new file mode 100644 index 0000000000..b34e8c6e8e --- /dev/null +++ b/core/server/data/migrations/versions/3.23/03-update-portal-button-setting.js @@ -0,0 +1,24 @@ +const logging = require('../../../../../shared/logging'); + +module.exports = { + config: { + transaction: true + }, + + async up(options) { + // update portal button setting to false + logging.info(`Updating portal button setting to false`); + return await options + .transacting('settings') + .where('key', 'portal_button') + .update({ + value: 'false' + }); + }, + + // `up` is only run to fix previously set default value for portal button, + // it doesn't make sense to be revert it back as `true` as feature is still behind dev flag + async down() { + return Promise.resolve(); + } +};