From e0cc314f91c58201f3a399eae3f09f56ef755ed7 Mon Sep 17 00:00:00 2001 From: Naz Date: Wed, 17 Feb 2021 16:04:25 +1300 Subject: [PATCH] Removed duplicate migration no issue - The migration didn't want to go away after rebases combined with renames --- .../4.0/17-refactor-unsplash-setting.js | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 core/server/data/migrations/versions/4.0/17-refactor-unsplash-setting.js diff --git a/core/server/data/migrations/versions/4.0/17-refactor-unsplash-setting.js b/core/server/data/migrations/versions/4.0/17-refactor-unsplash-setting.js deleted file mode 100644 index 91e180032f..0000000000 --- a/core/server/data/migrations/versions/4.0/17-refactor-unsplash-setting.js +++ /dev/null @@ -1,33 +0,0 @@ -const logging = require('../../../../../shared/logging'); -const {createIrreversibleMigration} = require('../../utils'); - -module.exports = createIrreversibleMigration(async (knex) => { - const unsplashSetting = await knex('settings') - .select('value') - .where({ - key: 'unsplash' - }) - .first(); - - let isActive; - try { - const value = JSON.parse(unsplashSetting.value); - isActive = typeof value.isActive === 'boolean' ? value.isActive : true; - } catch (err) { - logging.warn(`Wasn't able to parse 'unsplash' setting: ${unsplashSetting.value}, falling back to: 'true'`); - isActive = true; - } - - logging.info(`Updating 'unsplash' setting to: ${isActive}`); - - await knex('settings') - .update({ - group: 'unsplash', - type: 'boolean', - flags: null, - value: isActive.toString() - }) - .where({ - key: 'unsplash' - }); -});