From 0590d43a30b5f6b0452128f9f73181b74c398993 Mon Sep 17 00:00:00 2001 From: Mateusz Rajski Date: Tue, 13 Feb 2024 15:58:26 +0100 Subject: [PATCH] Migrate migrateOnyx module --- src/libs/{migrateOnyx.js => migrateOnyx.ts} | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) rename src/libs/{migrateOnyx.js => migrateOnyx.ts} (77%) diff --git a/src/libs/migrateOnyx.js b/src/libs/migrateOnyx.ts similarity index 77% rename from src/libs/migrateOnyx.js rename to src/libs/migrateOnyx.ts index 9b8b4056e3e5..97e698790d81 100644 --- a/src/libs/migrateOnyx.js +++ b/src/libs/migrateOnyx.ts @@ -1,24 +1,21 @@ -import _ from 'underscore'; import Log from './Log'; import KeyReportActionsDraftByReportActionID from './migrations/KeyReportActionsDraftByReportActionID'; -import PersonalDetailsByAccountID from './migrations/PersonalDetailsByAccountID'; import RemoveEmptyReportActionsDrafts from './migrations/RemoveEmptyReportActionsDrafts'; import RenameReceiptFilename from './migrations/RenameReceiptFilename'; import TransactionBackupsToCollection from './migrations/TransactionBackupsToCollection'; -export default function () { +export default function (): Promise { const startTime = Date.now(); Log.info('[Migrate Onyx] start'); return new Promise((resolve) => { // Add all migrations to an array so they are executed in order - const migrationPromises = [PersonalDetailsByAccountID, RenameReceiptFilename, KeyReportActionsDraftByReportActionID, TransactionBackupsToCollection, RemoveEmptyReportActionsDrafts]; + const migrationPromises = [RenameReceiptFilename, KeyReportActionsDraftByReportActionID, TransactionBackupsToCollection, RemoveEmptyReportActionsDrafts]; // Reduce all promises down to a single promise. All promises run in a linear fashion, waiting for the // previous promise to finish before moving onto the next one. /* eslint-disable arrow-body-style */ - _.reduce( - migrationPromises, + migrationPromises.reduce( (previousPromise, migrationPromise) => { return previousPromise.then(() => { return migrationPromise();