UBERF-9429: Provide workspace ids to storage adapters (#7956)

Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
Alexey Zinoviev
2025-02-14 15:59:36 +07:00
committed by GitHub
parent ddc8230890
commit e8df531654
53 changed files with 740 additions and 688 deletions
+5 -8
View File
@@ -22,8 +22,7 @@ import {
SortingOrder,
type Class,
type CollaborativeDoc,
type Doc,
type WorkspaceDataId
type Doc
} from '@hcengineering/core'
import { type Document, type DocumentSnapshot, type Teamspace } from '@hcengineering/document'
import {
@@ -209,8 +208,7 @@ async function renameFieldsRevert (client: MigrationClient): Promise<void> {
try {
const collabId = makeDocCollabId(document, 'content')
const dataId = client.wsIds.dataId ?? (client.wsIds.uuid as unknown as WorkspaceDataId)
const ydoc = await loadCollabYdoc(ctx, storage, dataId, collabId)
const ydoc = await loadCollabYdoc(ctx, storage, client.wsIds, collabId)
if (ydoc === undefined) {
continue
}
@@ -221,7 +219,7 @@ async function renameFieldsRevert (client: MigrationClient): Promise<void> {
yDocCopyXmlField(ydoc, 'description', 'content')
await saveCollabYdoc(ctx, storage, dataId, collabId, ydoc)
await saveCollabYdoc(ctx, storage, client.wsIds, collabId, ydoc)
} catch (err) {
ctx.error('error document content migration', { error: err, document: document.title })
}
@@ -257,8 +255,7 @@ async function restoreContentField (client: MigrationClient): Promise<void> {
for (const document of documents) {
try {
const collabId = makeDocCollabId(document, 'content')
const dataId = client.wsIds.dataId ?? (client.wsIds.uuid as unknown as WorkspaceDataId)
const ydoc = await loadCollabYdoc(ctx, storage, dataId, collabId)
const ydoc = await loadCollabYdoc(ctx, storage, client.wsIds, collabId)
if (ydoc === undefined) {
ctx.error('document content not found', { document: document.title })
continue
@@ -272,7 +269,7 @@ async function restoreContentField (client: MigrationClient): Promise<void> {
if (ydoc.share.has('')) {
yDocCopyXmlField(ydoc, '', 'content')
if (ydoc.share.has('content')) {
await saveCollabYdoc(ctx, storage, dataId, collabId, ydoc)
await saveCollabYdoc(ctx, storage, client.wsIds, collabId, ydoc)
} else {
ctx.error('document content still not found', { document: document.title })
}