0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Removed use of deprecated new Error() syntax

refs 2f1123d6ca
refs 6f1a3e1774

- The use of new Error() has been deprecated. Refactoring the migration  to use `createIrreversibleMigration` made most sense to have central error handling for migration which are not meant to be reverted.
This commit is contained in:
Naz 2021-07-14 12:16:44 +04:00
parent bfb899b293
commit 8f5d6ebf8c

View file

@ -1,8 +1,8 @@
const logging = require('@tryghost/logging');
const {createIrreversibleMigration} = require('../../utils');
module.exports = {
async up({connection}) {
let result = await connection('settings')
module.exports = createIrreversibleMigration(async (knex) => {
let result = await knex('settings')
.where('key', '=', 'labs')
.select('value');
@ -18,11 +18,7 @@ module.exports = {
logging.info(`Updating labs setting removing subscribers (was ${labs.subscribers}) settings members to ${labs.members}`);
labs.subscribers = undefined;
await connection('settings')
await knex('settings')
.where('key', '=', 'labs')
.update('value', JSON.stringify(labs));
},
async down() {
throw new Error();
}
};
});