From 47843bbfe9d46f90efb608a87cbfdd53c431c5fe Mon Sep 17 00:00:00 2001 From: Naz Date: Wed, 3 Feb 2021 12:12:31 +1300 Subject: [PATCH] Refactored migration to use transactional utility --- .../4.0/05-delete-apps-related-settings-keys.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/core/server/data/migrations/versions/4.0/05-delete-apps-related-settings-keys.js b/core/server/data/migrations/versions/4.0/05-delete-apps-related-settings-keys.js index 112ff197c6..76b2187bc3 100644 --- a/core/server/data/migrations/versions/4.0/05-delete-apps-related-settings-keys.js +++ b/core/server/data/migrations/versions/4.0/05-delete-apps-related-settings-keys.js @@ -1,10 +1,8 @@ +const {createTransactionalMigration} = require('../../utils'); const logging = require('../../../../../shared/logging'); -module.exports = { - config: { - transaction: true - }, - async up({transacting: knex}){ +module.exports = createTransactionalMigration( + async function up(knex){ const settingsKeys = ['installed_apps', 'active_apps']; logging.info(`Removing ${settingsKeys.join(',')} from "settings" table.`); @@ -12,7 +10,7 @@ module.exports = { .whereIn('key', settingsKeys) .del(); }, - async down() { + async function down() { // noop: no need to recreate any apps as it's a cleanup in major version migration } -}; +);