From 5abfbe64acb5ec6e1d1a77fae5fd8b1955b685ba Mon Sep 17 00:00:00 2001 From: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> Date: Thu, 17 Mar 2022 11:57:27 +0600 Subject: [PATCH] Migration fix (#1154) Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> --- models/core/src/migration.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/models/core/src/migration.ts b/models/core/src/migration.ts index 3b51360cdd..c12addeb67 100644 --- a/models/core/src/migration.ts +++ b/models/core/src/migration.ts @@ -41,6 +41,10 @@ async function migrateSpaces (client: MigrationUpgradeClient): Promise { let updateTxes = await client.findAll(core.class.TxUpdateDoc, { objectClass: { $in: descendants }, objectId: { $nin: [...currentSpaces, ...removedSpaces] } + }, { + sort: { + modifiedOn: 1 + } }) // TXes already stored, avoid dublicate id error updateTxes = updateTxes.map((p) => { @@ -49,7 +53,9 @@ async function migrateSpaces (client: MigrationUpgradeClient): Promise { space: core.space.DerivedTx } }) - await Promise.all(updateTxes.map(async (tx) => await client.tx(tx))) + for (const tx of updateTxes) { + await client.tx(tx) + } } export const coreOperation: MigrateOperation = {