mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 16:56:07 +00:00
fix: extra logging in documents content migration (#5868)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
dedff23b31
commit
c88adbc5a9
@ -275,11 +275,7 @@ async function migrateTeamspacesMixins (client: MigrationClient): Promise<void>
|
|||||||
|
|
||||||
async function migrateContentField (client: MigrationClient): Promise<void> {
|
async function migrateContentField (client: MigrationClient): Promise<void> {
|
||||||
const ctx = new MeasureMetricsContext('migrate_content_field', {})
|
const ctx = new MeasureMetricsContext('migrate_content_field', {})
|
||||||
|
|
||||||
const storage = client.storageAdapter
|
const storage = client.storageAdapter
|
||||||
if (storage === undefined) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const documents = await client.find<Document>(DOMAIN_DOCUMENT, {
|
const documents = await client.find<Document>(DOMAIN_DOCUMENT, {
|
||||||
_class: document.class.Document,
|
_class: document.class.Document,
|
||||||
@ -290,17 +286,20 @@ async function migrateContentField (client: MigrationClient): Promise<void> {
|
|||||||
try {
|
try {
|
||||||
const ydoc = await loadCollaborativeDoc(storage, client.workspaceId, document.content, ctx)
|
const ydoc = await loadCollaborativeDoc(storage, client.workspaceId, document.content, ctx)
|
||||||
if (ydoc === undefined) {
|
if (ydoc === undefined) {
|
||||||
|
ctx.error('document content not found', { document: document.name })
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ydoc.share.has('')) {
|
if (!ydoc.share.has('') || ydoc.share.has('content')) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
yDocCopyXmlField(ydoc, '', 'content')
|
yDocCopyXmlField(ydoc, '', 'content')
|
||||||
|
|
||||||
await saveCollaborativeDoc(storage, client.workspaceId, document.content, ydoc, ctx)
|
await saveCollaborativeDoc(storage, client.workspaceId, document.content, ydoc, ctx)
|
||||||
} catch {}
|
} catch (err) {
|
||||||
|
ctx.error('error document content migration', { error: err, document: document.name })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ export interface MigrationClient {
|
|||||||
model: ModelDb
|
model: ModelDb
|
||||||
|
|
||||||
migrateState: Map<string, Set<string>>
|
migrateState: Map<string, Set<string>>
|
||||||
storageAdapter?: StorageAdapter
|
storageAdapter: StorageAdapter
|
||||||
|
|
||||||
workspaceId: WorkspaceId
|
workspaceId: WorkspaceId
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user