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/disable table comment for unsupported db (#518)
Abeautifulsnow310cc22b376c
diff --git a/apps/desktop/src/components/structure/TableStructureEditor.vue b/apps/desktop/src/components/structure/TableStructureEditor.vueindex 54d42d5b6e..a3c914920a 100644--- a/apps/desktop/src/components/structure/TableStructureEditor.vue+++ b/apps/desktop/src/components/structure/TableStructureEditor.vue@@ -12,6 +12,7 @@ import {ChevronDown,ChevronUp,Database,+ Info,KeyRound,Loader2,Maximize2,@@ -28,6 +29,7 @@ import {DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";import { SearchableSelect } from "@/components/ui/searchable-select";import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";import { useConnectionStore } from "@/stores/connectionStore";@@ -134,6 +136,7 @@ function onIndexColResize(e: MouseEvent, col: number) {const connection = computed(() => (props.connectionId ? store.getConfig(props.connectionId) : undefined));const databaseType = computed(() => connection.value?.db_type);const structureCapabilities = computed(() => getTableStructureCapabilities(databaseType.value));+const isTableCommentDisabled = computed(() => !structureCapabilities.value.comment);const dataTypeOptions = computed(() => DATA_TYPE_OPTIONS[databaseType.value ?? ""] ?? []);const indexTypesByDb: Record<string, string[]> = {@@ -509,7 +512,14 @@ watch(v-model="tableComment":placeholder="t('structureEditor.tableCommentPlaceholder')"class="h-6 max-w-[320px] text-[11px]"+ :disabled="isTableCommentDisabled"/>+ <Tooltip v-if="isTableCommentDisabled">+ <TooltipTrigger as-child>+ <Info class="h-4 w-4 shrink-0 text-muted-foreground" />+ </TooltipTrigger>+ <TooltipContent>{{ t("structureEditor.tableCommentUnsupported") }}</TooltipContent>+ </Tooltip></div><div v-if="loading" class="flex min-h-0 flex-1 items-center justify-center gap-2 text-sm text-muted-foreground">diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.tsindex 235150e9ca..7afdab5d63 100644--- a/apps/desktop/src/i18n/locales/en.ts+++ b/apps/desktop/src/i18n/locales/en.ts@@ -989,6 +989,7 @@ export default {editComment: "Edit comment",commentPlaceholder: "Enter column comment...",tableCommentPlaceholder: "Enter table comment...",+ tableCommentUnsupported: "Table comments are not supported by this database",actions: "Actions",indexName: "Index",indexColumns: "Columns",diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.tsindex fe41a9cb2b..6441037649 100644--- a/apps/desktop/src/i18n/locales/es.ts+++ b/apps/desktop/src/i18n/locales/es.ts@@ -883,6 +883,7 @@ export default {editComment: "Editar comentario",commentPlaceholder: "Ingresar comentario de columna...",tableCommentPlaceholder: "Ingresar comentario de tabla...",+ tableCommentUnsupported: "La base de datos no admite comentarios de tabla",actions: "Acciones",indexName: "Índice",indexColumns: "Columnas",diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.tsindex 6b89897d6f..5a7764f3fe 100644--- a/apps/desktop/src/i18n/locales/zh-CN.ts+++ b/apps/desktop/src/i18n/locales/zh-CN.ts@@ -967,6 +967,7 @@ export default {editComment: "编辑注释",commentPlaceholder: "输入字段注释...",tableCommentPlaceholder: "输入表注释...",+ tableCommentUnsupported: "当前数据库不支持表注释",actions: "操作",indexName: "索引名",indexColumns: "字段列表",diff --git a/packages/app-tests/tableStructureCapabilities.test.ts b/packages/app-tests/tableStructureCapabilities.test.tsindex 560c2caf14..b8483b5214 100644--- a/packages/app-tests/tableStructureCapabilities.test.ts+++ b/packages/app-tests/tableStructureCapabilities.test.ts@@ -5,6 +5,14 @@ import {getTableStructureCapabilities,} from "../../apps/desktop/src/lib/tableStructureCapabilities.ts";+test("sqlite and duckdb do not support table comments", () => {+ for (const dbType of ["sqlite", "duckdb"] as const) {+ const caps = getTableStructureCapabilities(dbType);+ assert.equal(caps.comment, false, `${dbType} should not support comments`);+ assert.equal(caps.createTable, true, `${dbType} should still support creating tables`);+ }+});+test("postgres-like databases expose safe structure editing capabilities", () => {for (const dbType of ["postgres", "gaussdb", "opengauss", "highgo", "vastbase", "kingbase"] as const) {const caps = getTableStructureCapabilities(dbType);diff --git a/packages/app-tests/tableStructureEditorPresentation.test.ts b/packages/app-tests/tableStructureEditorPresentation.test.tsindex 55947217bf..2955fb42e4 100644--- a/packages/app-tests/tableStructureEditorPresentation.test.ts+++ b/packages/app-tests/tableStructureEditorPresentation.test.ts@@ -80,3 +80,11 @@ test("new column input is focused after adding a field", () => {assert.match(source, /data-column-name-input/);assert.match(source, /input\?\.focus\(\)/);});++test("table comment input is disabled and shows tooltip when database does not support comments", () => {+ assert.match(source, /isTableCommentDisabled/);+ assert.match(source, /:disabled="isTableCommentDisabled"/);+ assert.match(source, /v-if="isTableCommentDisabled"/);+ assert.match(source, /Tooltip/);+ assert.match(source, /tableCommentUnsupported/);+});