mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-07 18:27:44 +02:00
UBERF-7297: Allow to backup-restore from v0.6.239 (#5837)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
+15
-2
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user