feat(backup): 实例备份第1轮——独立备份库迁移、settings 仓库路径字段、备份进度事件

This commit is contained in:
AxTps committed 2026-10-03 09:12:35 +08:00
1 parent 95a3e00b03
commit e91ba2ae74
11 files changed
+298 -1

No files matched your search

@@ -0,0 +1,26 @@
CREATE TABLE backup_operations (
id TEXT PRIMARY KEY,
operation_type TEXT NOT NULL
CHECK (operation_type IN ('create', 'restore')),
instance_id TEXT NOT NULL,
snapshot_id TEXT,
state TEXT NOT NULL
CHECK (state IN (
'queued', 'scanning', 'hashing', 'saving', 'validating',
'materializing', 'applying', 'completed', 'cancelled', 'failed', 'interrupted'
)),
processed_bytes INTEGER NOT NULL DEFAULT 0,
total_bytes INTEGER NOT NULL DEFAULT 0,
cancellable INTEGER NOT NULL DEFAULT 1,
error TEXT,
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL,
finished_at INTEGER
);
CREATE INDEX backup_operations_instance_created
ON backup_operations(instance_id, created_at DESC);
CREATE INDEX backup_operations_active
ON backup_operations(state, updated_at DESC)
WHERE state NOT IN ('completed', 'cancelled', 'failed', 'interrupted');