mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-20 23:32:14 +00:00
Fix migration (#7197)
This commit is contained in:
parent
6292e58119
commit
a374f22acc
@ -312,13 +312,10 @@ export const coreOperation: MigrateOperation = {
|
|||||||
_class: 'core:class:TxCollectionCUD' as Ref<Class<Doc>>
|
_class: 'core:class:TxCollectionCUD' as Ref<Class<Doc>>
|
||||||
})
|
})
|
||||||
while (true) {
|
while (true) {
|
||||||
const txes = await iterator.next(1000)
|
const txes = await iterator.next(200)
|
||||||
if (txes === null || txes.length === 0) break
|
if (txes === null || txes.length === 0) break
|
||||||
processed += txes.length
|
processed += txes.length
|
||||||
try {
|
try {
|
||||||
await client.deleteMany(DOMAIN_TX, {
|
|
||||||
_id: { $in: txes.map((it) => it._id) }
|
|
||||||
})
|
|
||||||
await client.create(
|
await client.create(
|
||||||
DOMAIN_TX,
|
DOMAIN_TX,
|
||||||
txes.map((tx) => {
|
txes.map((tx) => {
|
||||||
@ -327,10 +324,14 @@ export const coreOperation: MigrateOperation = {
|
|||||||
collection,
|
collection,
|
||||||
attachedTo: objectId,
|
attachedTo: objectId,
|
||||||
attachedToClass: objectClass,
|
attachedToClass: objectClass,
|
||||||
...(tx as any).tx
|
...(tx as any).tx,
|
||||||
|
objectSpace: (tx as any).tx.objectSpace ?? tx.objectClass
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
await client.deleteMany(DOMAIN_TX, {
|
||||||
|
_id: { $in: txes.map((it) => it._id) }
|
||||||
|
})
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user