mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Removed use of deprecated new Error() syntax
refs2f1123d6ca
refs6f1a3e1774
- 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:
parent
bfb899b293
commit
8f5d6ebf8c
1 changed files with 20 additions and 24 deletions
|
@ -1,8 +1,8 @@
|
||||||
const logging = require('@tryghost/logging');
|
const logging = require('@tryghost/logging');
|
||||||
|
const {createIrreversibleMigration} = require('../../utils');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = createIrreversibleMigration(async (knex) => {
|
||||||
async up({connection}) {
|
let result = await knex('settings')
|
||||||
let result = await connection('settings')
|
|
||||||
.where('key', '=', 'labs')
|
.where('key', '=', 'labs')
|
||||||
.select('value');
|
.select('value');
|
||||||
|
|
||||||
|
@ -18,11 +18,7 @@ module.exports = {
|
||||||
logging.info(`Updating labs setting removing subscribers (was ${labs.subscribers}) settings members to ${labs.members}`);
|
logging.info(`Updating labs setting removing subscribers (was ${labs.subscribers}) settings members to ${labs.members}`);
|
||||||
labs.subscribers = undefined;
|
labs.subscribers = undefined;
|
||||||
|
|
||||||
await connection('settings')
|
await knex('settings')
|
||||||
.where('key', '=', 'labs')
|
.where('key', '=', 'labs')
|
||||||
.update('value', JSON.stringify(labs));
|
.update('value', JSON.stringify(labs));
|
||||||
},
|
});
|
||||||
async down() {
|
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue