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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(export): allow routine-only database exports
t8y2b4b04d30b8db
diff --git a/apps/desktop/src/components/export/DatabaseExportDialog.vue b/apps/desktop/src/components/export/DatabaseExportDialog.vueindex 7dfa01f860..8298bde53c 100644--- a/apps/desktop/src/components/export/DatabaseExportDialog.vue+++ b/apps/desktop/src/components/export/DatabaseExportDialog.vue@@ -13,7 +13,7 @@ import type { ExportProgress } from "@/lib/backend/api";import { isSchemaAware, isSingleDatabase } from "@/lib/database/databaseFeatureSupport";import { databaseOptionsForConnection, fetchNamespaceOptionsForConnection } from "@/composables/useDatabaseOptions";import { buildAllDatabaseExportPlan, generateDatabaseExportId, runDatabaseExportUntilTerminal, runWithDatabaseBackupSnapshot, shouldUseDatabaseBackupSnapshot, type AllDatabaseExportPlanItem } from "@/lib/export/databaseExport";-import { buildSelectedTablesPayload } from "@/lib/export/databaseExportSelection";+import { buildSelectedTablesPayload, isDatabaseExportTableSelectionValid } from "@/lib/export/databaseExportSelection";import { isTauriRuntime } from "@/lib/backend/tauriRuntime";import { useToast } from "@/composables/useToast";import { Input } from "@/components/ui/input";@@ -109,7 +109,18 @@ const canExport = computed(() => {const hasContent = includeStructure.value || includeData.value || includeObjects.value;if (!connectionId.value || !hasContent || isExporting.value) return false;if (exportAllDatabases.value) return selectedDatabases.value.length > 0 && !loadingMeta.value;- return database.value && schema.value && !loadingTables.value && !tableError.value && (tables.value.length === 0 || selectedTables.value.length > 0);+ return (+ database.value &&+ schema.value &&+ !loadingTables.value &&+ !tableError.value &&+ isDatabaseExportTableSelectionValid({+ allTableCount: tables.value.length,+ selectedTableCount: selectedTables.value.length,+ includeStructure: includeStructure.value,+ includeData: includeData.value,+ })+ );});const selectedTableSet = computed(() => new Set(selectedTables.value));@@ -340,7 +351,7 @@ async function startExport() {database: database.value,schema: schema.value,filePath,- selectedTables: buildSelectedTablesPayload(tables.value, selectedTables.value),+ selectedTables: includeStructure.value || includeData.value ? buildSelectedTablesPayload(tables.value, selectedTables.value) : undefined,includeStructure: includeStructure.value,includeData: includeData.value,includeObjects: includeObjects.value,diff --git a/apps/desktop/src/lib/export/databaseExportSelection.ts b/apps/desktop/src/lib/export/databaseExportSelection.tsindex 5e7b9e19d5..15e18ec1ec 100644--- a/apps/desktop/src/lib/export/databaseExportSelection.ts+++ b/apps/desktop/src/lib/export/databaseExportSelection.ts@@ -6,3 +6,13 @@ export function buildSelectedTablesPayload(allTables: string[], selectedTables:const selected = new Set(selectedTables);return allTables.filter((table) => selected.has(table));}++export function isDatabaseExportTableSelectionValid(options: {+ allTableCount: number;+ selectedTableCount: number;+ includeStructure: boolean;+ includeData: boolean;+}): boolean {+ if (!options.includeStructure && !options.includeData) return true;+ return options.allTableCount === 0 || options.selectedTableCount > 0;+}diff --git a/packages/app-tests/databaseExportPlan.test.ts b/packages/app-tests/databaseExportPlan.test.tsindex d20c0ea5da..288a9108a6 100644--- a/packages/app-tests/databaseExportPlan.test.ts+++ b/packages/app-tests/databaseExportPlan.test.ts@@ -1,6 +1,40 @@import assert from "node:assert/strict";import { test } from "vitest";import { buildAllDatabaseExportPlan } from "../../apps/desktop/src/lib/export/databaseExport.ts";+import { isDatabaseExportTableSelectionValid } from "../../apps/desktop/src/lib/export/databaseExportSelection.ts";++test("database export allows object-only exports without selecting tables", () => {+ assert.equal(+ isDatabaseExportTableSelectionValid({+ allTableCount: 982,+ selectedTableCount: 0,+ includeStructure: false,+ includeData: false,+ }),+ true,+ );+});++test("database export still requires a table when exporting structure or data", () => {+ assert.equal(+ isDatabaseExportTableSelectionValid({+ allTableCount: 982,+ selectedTableCount: 0,+ includeStructure: true,+ includeData: false,+ }),+ false,+ );+ assert.equal(+ isDatabaseExportTableSelectionValid({+ allTableCount: 982,+ selectedTableCount: 1,+ includeStructure: false,+ includeData: true,+ }),+ true,+ );+});test("all-database export includes every schema for schema-aware databases", () => {const plan = buildAllDatabaseExportPlan({