Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(backup): hide unsupported database backup entries

zipg992ac00aff54
diff --git a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
index a5d9c6fac2..1f54cd71e1 100644
--- a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
+++ b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
@@ -174,6 +174,7 @@ import { runBatchTableTruncate } from "@/lib/table/batchTableTruncate";
import { runBatchTableDrop } from "@/lib/table/batchTableDrop";
import { buildSidebarDdlTemplateSql, sidebarDdlTargetsForExecutionContext } from "@/lib/sidebar/sidebarDdlTemplate";
import { sidebarStructureExportTargets } from "@/lib/sidebar/sidebarExportRuntime";
+import { supportsScheduledDatabaseBackup } from "@/lib/backup/scheduledDatabaseBackup";
import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
import { copyToClipboard } from "@/lib/common/clipboard";
import { rankSavedSqlHistory, type SavedSqlHistoryScope } from "@/lib/savedSql/savedSqlHistory";
@@ -4076,6 +4077,13 @@ const canExportAllDatabases = computed(() => {
return !["redis", "mongodb", "dynamodb", "elasticsearch", "easysearch", "meilisearch", "qdrant", "milvus", "weaviate", "chromadb", "etcd", "zookeeper", "consul", "mq", "nacos"].includes(dbType || "");
});
+const canOpenScheduledBackups = computed(() => {
+ // Match the backup page/engine, which filter and key off the raw db_type
+ // (effectiveDatabaseTypeForConnection maps gbase/mysql-dialect jdbc to "mysql",
+ // which would show an entry the backup dialog then can't list).
+ return isTauriRuntime() && supportsScheduledDatabaseBackup(rawDatabaseType());
+});
+
const canOpenDiagram = computed(() => {
return !!activeNode.value.database && supportsSchemaDiagram(currentDatabaseType());
});
@@ -4872,9 +4880,9 @@ function buildConnectionSidebarMenu(context: SidebarMenuFactoryContext): boolean
}
if (canExportAllDatabases.value) {
items.push({ label: t("contextMenu.exportAllDatabases"), action: openAllDatabasesExport, icon: Upload });
- if (isTauriRuntime()) {
- items.push({ label: t("databaseBackup.title"), action: openScheduledBackups, icon: CalendarClock });
- }
+ }
+ if (canOpenScheduledBackups.value) {
+ items.push({ label: t("databaseBackup.title"), action: openScheduledBackups, icon: CalendarClock });
}
if (canCreateDatabase.value) {
items.push({
diff --git a/apps/desktop/src/components/sidebar/__tests__/SidebarTreeRuntimeHost.backupMenu.spec.ts b/apps/desktop/src/components/sidebar/__tests__/SidebarTreeRuntimeHost.backupMenu.spec.ts
new file mode 100644
index 0000000000..5795a16d9c
--- /dev/null
+++ b/apps/desktop/src/components/sidebar/__tests__/SidebarTreeRuntimeHost.backupMenu.spec.ts
@@ -0,0 +1,11 @@
+import { readFileSync } from "node:fs";
+import { describe, expect, it } from "vitest";
+
+const source = readFileSync(new URL("../SidebarTreeRuntimeHost.vue", import.meta.url), "utf8");
+
+describe("SidebarTreeRuntimeHost database backup menu", () => {
+ it("uses the database backup support matrix independently from full-database export", () => {
+ expect(source).toMatch(/const canOpenScheduledBackups = computed\(\(\) => \{[\s\S]*supportsScheduledDatabaseBackup\(rawDatabaseType\(\)\)/);
+ expect(source).toMatch(/if \(canOpenScheduledBackups\.value\) \{[\s\S]*action: openScheduledBackups/);
+ });
+});
diff --git a/packages/app-tests/scheduledDatabaseBackup.test.ts b/packages/app-tests/scheduledDatabaseBackup.test.ts
index 0ea1a8d456..24dc3a04a3 100644
--- a/packages/app-tests/scheduledDatabaseBackup.test.ts
+++ b/packages/app-tests/scheduledDatabaseBackup.test.ts
@@ -268,6 +268,7 @@ test("explicit backup databases fail when any configured target is missing", ()
test("scheduled backups are limited to databases with consistent snapshot support", () => {
assert.equal(supportsScheduledDatabaseBackup("postgres"), true);
assert.equal(supportsScheduledDatabaseBackup("mysql"), true);
+ assert.equal(supportsScheduledDatabaseBackup("dameng"), false);
assert.equal(supportsScheduledDatabaseBackup("sqlite"), false);
assert.equal(supportsScheduledDatabaseBackup("sqlserver"), false);
});