From a973d2a0fdbe3b713b903caf37716adf64e0937c Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Tue, 11 Jan 2022 16:12:31 +0700 Subject: [PATCH] Fix extra transactions during workspace upgrace (#792) Signed-off-by: Andrey Sobolev --- models/core/src/migration.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/core/src/migration.ts b/models/core/src/migration.ts index 597bf77edc..4e62e04ef2 100644 --- a/models/core/src/migration.ts +++ b/models/core/src/migration.ts @@ -25,12 +25,12 @@ import core from './component' export const coreOperation: MigrateOperation = { async migrate (client: MigrationClient): Promise {}, async upgrade (client: MigrationUpgradeClient): Promise { - const ops = new TxOperations(client, core.account.System) const targetSpaces = (await client.findAll(core.class.Space, {})) .filter((space) => space.archived == null) + // Modify spaces by their's creators await Promise.all(targetSpaces.map( - (space) => ops.updateDoc(space._class, space.space, space._id, { archived: false }) + (space) => new TxOperations(client, space.modifiedBy).updateDoc(space._class, space.space, space._id, { archived: false }) )).catch((e) => console.error(e)) } }