Migration fix (#1154)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov 2022-03-17 11:57:27 +06:00 committed by GitHub
parent 0d2221e567
commit 5abfbe64ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,6 +41,10 @@ async function migrateSpaces (client: MigrationUpgradeClient): Promise<void> {
let updateTxes = await client.findAll(core.class.TxUpdateDoc, { let updateTxes = await client.findAll(core.class.TxUpdateDoc, {
objectClass: { $in: descendants }, objectClass: { $in: descendants },
objectId: { $nin: [...currentSpaces, ...removedSpaces] } objectId: { $nin: [...currentSpaces, ...removedSpaces] }
}, {
sort: {
modifiedOn: 1
}
}) })
// TXes already stored, avoid dublicate id error // TXes already stored, avoid dublicate id error
updateTxes = updateTxes.map((p) => { updateTxes = updateTxes.map((p) => {
@ -49,7 +53,9 @@ async function migrateSpaces (client: MigrationUpgradeClient): Promise<void> {
space: core.space.DerivedTx 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 = { export const coreOperation: MigrateOperation = {