feat(backup): add scheduled database backups

This commit is contained in:
CSXFanMeng authored and GitHub committed 2026-07-16 18:49:15 +08:00
1 parent cc518e8753
commit f08a0b7f7f
26 files changed
+2491 -137

No files matched your search

@@ -12,7 +12,7 @@ import * as api from "@/lib/backend/api";
import type { ExportProgress } from "@/lib/backend/api";
import { isSchemaAware } from "@/lib/database/databaseFeatureSupport";
import { databaseOptionsForConnection } from "@/composables/useDatabaseOptions";
import { buildAllDatabaseExportPlan, generateDatabaseExportId, type AllDatabaseExportPlanItem } from "@/lib/export/databaseExport";
import { buildAllDatabaseExportPlan, generateDatabaseExportId, runDatabaseExportUntilTerminal, type AllDatabaseExportPlanItem } from "@/lib/export/databaseExport";
import { buildSelectedTablesPayload } from "@/lib/export/databaseExportSelection";
import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
import { useToast } from "@/composables/useToast";
@@ -111,21 +111,6 @@ function currentRowsExported(): number {
return progress?.rowsExported ?? 0;
}
async function runDatabaseExportUntilTerminal(request: api.DatabaseExportRequest, onProgress: (progress: ExportProgress) => void): Promise<void> {
await new Promise<void>((resolve, reject) => {
api
.exportDatabaseSql(request, (progress) => {
onProgress(progress);
if (progress.status === "Done" || progress.status === "Cancelled") {
resolve();
} else if (progress.status === "Error") {
reject(new Error(progress.error || "Export failed"));
}
})
.catch(reject);
});
}
async function loadDatabases(connId: string) {
if (!connId) return;
loadingMeta.value = true;