UBERF-7297: Allow to backup-restore from v0.6.239 (#5837)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2024-06-17 19:50:19 +05:00
committed by GitHub
parent bcae079c5c
commit df4e763781
2 changed files with 104 additions and 7 deletions
+15 -2
View File
@@ -38,6 +38,7 @@ import {
import { setMetadata } from '@hcengineering/platform'
import {
backup,
backupFind,
backupList,
compactBackup,
createFileBackupStorage,
@@ -60,6 +61,8 @@ import core, {
metricsToString,
versionToString,
type Data,
type Doc,
type Ref,
type Tx,
type Version
} from '@hcengineering/core'
@@ -584,6 +587,7 @@ export function devTool (
program
.command('backup <dirName> <workspace>')
.description('dump workspace transactions and minio resources')
.option('-i, --include <include>', 'A list of ; separated domain names to include during backup', '*')
.option('-s, --skip <skip>', 'A list of ; separated domain names to skip during backup', '')
.option('-f, --force', 'Force backup', false)
.option('-c, --recheck', 'Force hash recheck on server', false)
@@ -592,18 +596,27 @@ export function devTool (
async (
dirName: string,
workspace: string,
cmd: { skip: string, force: boolean, recheck: boolean, timeout: string }
cmd: { skip: string, force: boolean, recheck: boolean, timeout: string, include: string }
) => {
const storage = await createFileBackupStorage(dirName)
await backup(toolCtx, transactorUrl, getWorkspaceId(workspace, productId), storage, {
force: cmd.force,
recheck: cmd.recheck,
include: cmd.include === '*' ? undefined : new Set(cmd.include.split(';').map((it) => it.trim())),
skipDomains: (cmd.skip ?? '').split(';').map((it) => it.trim()),
timeout: 0,
connectTimeout: parseInt(cmd.timeout) * 1000
})
}
)
program
.command('backup-find <dirName> <fileId>')
.description('dump workspace transactions and minio resources')
.option('-d, --domain <domain>', 'Check only domain')
.action(async (dirName: string, fileId: string, cmd: { domain: string | undefined }) => {
const storage = await createFileBackupStorage(dirName)
await backupFind(storage, fileId as unknown as Ref<Doc>, cmd.domain)
})
program
.command('backup-compact <dirName>')
@@ -619,7 +632,7 @@ export function devTool (
.option('-m, --merge', 'Enable merge of remote and backup content.', false)
.option('-p, --parallel <parallel>', 'Enable merge of remote and backup content.', '1')
.option('-c, --recheck', 'Force hash recheck on server', false)
.option('-s, --include <include>', 'A list of ; separated domain names to include during backup', '*')
.option('-i, --include <include>', 'A list of ; separated domain names to include during backup', '*')
.option('-s, --skip <skip>', 'A list of ; separated domain names to skip during backup', '')
.description('dump workspace transactions and minio resources')
.action(