0
Fork 0
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:
Fabien O'Carroll 2019-10-17 16:21:12 +07:00
parent 1fb41e1946
commit a500c3761f

View file

@ -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();
}
};