mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Added migration for subscriber labs flag
no-issue
This commit is contained in:
parent
1fb41e1946
commit
a500c3761f
1 changed files with 28 additions and 0 deletions
|
@ -0,0 +1,28 @@
|
|||
const common = require('../../../../lib/common');
|
||||
|
||||
module.exports = {
|
||||
async up({connection}) {
|
||||
let result = await connection('settings')
|
||||
.where('key', '=', 'labs')
|
||||
.select('value');
|
||||
|
||||
if (!result || !result[0]) {
|
||||
common.logging.warn(`Could not find labs setting`);
|
||||
result = [{}];
|
||||
}
|
||||
|
||||
const labs = JSON.parse(result[0].value);
|
||||
|
||||
labs.members = !!labs.members || !!labs.subscribers;
|
||||
|
||||
common.logging.info(`Updating labs setting removing subscribers (was ${labs.subscribers}) settings members to ${labs.members}`);
|
||||
labs.subscribers = undefined;
|
||||
|
||||
await connection('settings')
|
||||
.where('key', '=', 'labs')
|
||||
.update('value', JSON.stringify(labs));
|
||||
},
|
||||
async down() {
|
||||
throw new Error();
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue