From 218042cfd26a38181c7efa569ce5b08c51235f10 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Thu, 14 May 2026 23:32:43 +0800 Subject: [PATCH] fix: show schemas directly under connection for DM8 and Oracle (#259) Single-database types (DM8, Oracle) now use list_schemas instead of list_databases when expanding a connection, matching Navicat/DataGrip behavior and returning the complete schema list. --- src/stores/connectionStore.ts | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/stores/connectionStore.ts b/src/stores/connectionStore.ts index f5185dbe6..fdbdf4d1e 100644 --- a/src/stores/connectionStore.ts +++ b/src/stores/connectionStore.ts @@ -565,13 +565,33 @@ export const useConnectionStore = defineStore("connection", () => { try { await ensureConnected(connectionId); if (useCachedChildren(node, options)) return; - const cacheKey = schemaCacheKey(connectionId, "databases"); - if (!options?.force && (await loadPersistedTreeChildren(node, cacheKey))) return; - const databases = await api.listDatabases(connectionId); - const children = withSavedSqlRoot(connectionId, buildDatabaseTreeNodes(connectionId, databases), node); - setChildren(node, children); - await savePersistedTreeChildren(cacheKey, children); + const config = getConfig(connectionId); + if (config?.db_type === "dameng" || config?.db_type === "oracle") { + const effectiveDb = config.database || ""; + const cacheKey = schemaCacheKey(connectionId, effectiveDb, "schemas"); + if (!options?.force && (await loadPersistedTreeChildren(node, cacheKey))) return; + const schemas = await api.listSchemas(connectionId, effectiveDb); + const schemaNodes: TreeNode[] = schemas.map((s) => ({ + id: `${connectionId}:${s}:${s}`, + label: s, + type: "schema" as const, + connectionId, + database: s, + schema: s, + isExpanded: false, + children: [], + })); + setChildren(node, withSavedSqlRoot(connectionId, schemaNodes, node)); + await savePersistedTreeChildren(cacheKey, schemaNodes); + } else { + const cacheKey = schemaCacheKey(connectionId, "databases"); + if (!options?.force && (await loadPersistedTreeChildren(node, cacheKey))) return; + const databases = await api.listDatabases(connectionId); + const children = withSavedSqlRoot(connectionId, buildDatabaseTreeNodes(connectionId, databases), node); + setChildren(node, children); + await savePersistedTreeChildren(cacheKey, children); + } node.isExpanded = true; } finally { node.isLoading = false;