diff --git a/server/account/src/operations.ts b/server/account/src/operations.ts index 353676e97d..fca23f3147 100644 --- a/server/account/src/operations.ts +++ b/server/account/src/operations.ts @@ -867,6 +867,10 @@ export async function listWorkspaces ( ): Promise { decodeToken(ctx, token) // Just verify token is valid + if (region === '') { + region = null + } + return (await db.workspace.find(region != null ? { region } : {})) .filter((it) => it.disabled !== true) .map(trimWorkspaceInfo) @@ -903,6 +907,9 @@ export async function countWorkspacesInRegion ( * @public */ export async function listWorkspacesRaw (db: AccountDB, region?: string): Promise { + if (region === '') { + region = undefined + } return (await db.workspace.find(region !== undefined ? { region } : {})).filter((it) => it.disabled !== true) } diff --git a/server/backup/src/backup.ts b/server/backup/src/backup.ts index 3629d74643..cdd487c105 100644 --- a/server/backup/src/backup.ts +++ b/server/backup/src/backup.ts @@ -1652,6 +1652,7 @@ export async function restore ( storageAdapter?: StorageAdapter token?: string progress?: (progress: number) => Promise + cleanIndexState?: boolean } ): Promise { const infoFile = 'backup.json.gz' @@ -1845,6 +1846,11 @@ export async function restore ( tx.objectSpace = core.space.Workspace } } + if (opt.cleanIndexState === true) { + if (d._class === core.class.DocIndexState) { + ;(d as DocIndexState).needIndex = true + } + } } if (opt.recheck === true) { diff --git a/server/backup/src/service.ts b/server/backup/src/service.ts index 33fd201284..1f60a65fe3 100644 --- a/server/backup/src/service.ts +++ b/server/backup/src/service.ts @@ -347,13 +347,8 @@ export async function doRestoreWorkspace ( bucketName: string, pipelineFactory: PipelineFactory, workspaceStorageAdapter: StorageAdapter, - getConfig: ( - ctx: MeasureContext, - workspace: WorkspaceIdWithUrl, - branding: Branding | null, - externalStorage: StorageAdapter - ) => DbConfiguration, skipDomains: string[], + cleanIndexState: boolean, notify?: (progress: number) => Promise ): Promise { rootCtx.warn('\nRESTORE WORKSPACE ', { @@ -374,6 +369,7 @@ export async function doRestoreWorkspace ( skip: new Set(skipDomains), recheck: true, storageAdapter: workspaceStorageAdapter, + cleanIndexState, getConnection: async () => { if (pipeline === undefined) { pipeline = await pipelineFactory(ctx, wsUrl, true, () => {}, null) diff --git a/server/workspace-service/src/service.ts b/server/workspace-service/src/service.ts index eb82df5ece..24cd9bcffd 100644 --- a/server/workspace-service/src/service.ts +++ b/server/workspace-service/src/service.ts @@ -530,13 +530,8 @@ export class WorkspaceWorker { opt.backup.bucketName, pipelineFactory, workspaceStorageAdapter, - (ctx, workspace, branding, externalStorage) => { - return getConfig(ctx, dbUrl, ctx, { - externalStorage, - disableTriggers: true - }) - }, ['blob'], + true, (_p: number) => { if (progress !== Math.round(_p)) { progress = Math.round(_p)