mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Added migration to update group for new portal settings
closes https://github.com/TryGhost/Ghost/issues/12026 - 3 new portal settings were added in `3.23` in default settings - `portal_button_style`, `portal_button_icon`, `portal_button_signup_text` - New settings default to group `core` on migrating from pre 3.22 versions due to missing columns in DB - Migration here updates the new settings to correct group
This commit is contained in:
parent
1d8154f892
commit
5fbc40430b
1 changed files with 37 additions and 0 deletions
|
@ -0,0 +1,37 @@
|
|||
const logging = require('../../../../../shared/logging');
|
||||
|
||||
// new setting keys and group mapping
|
||||
const groupMapping = [{
|
||||
group: 'portal',
|
||||
keys: [
|
||||
'portal_button_style',
|
||||
'portal_button_icon',
|
||||
'portal_button_signup_text'
|
||||
]
|
||||
}];
|
||||
|
||||
module.exports = {
|
||||
config: {
|
||||
transaction: true
|
||||
},
|
||||
|
||||
async up(options) {
|
||||
// set the correct group value for new settings
|
||||
await Promise.map(groupMapping, async (groupMap) => {
|
||||
return await Promise.map(groupMap.keys, async (key) => {
|
||||
logging.info(`Updating setting ${key} to group ${groupMap.group}`);
|
||||
|
||||
return await options
|
||||
.transacting('settings')
|
||||
.where('key', key)
|
||||
.update({
|
||||
group: groupMap.group
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// `up` is only run to update correct group value for each setting instead of default.
|
||||
// it doesn't make sense to be revert a setting's group to default `core` again
|
||||
async down() {}
|
||||
};
|
Loading…
Add table
Reference in a new issue