refactor: centralize database type groups into databaseCapabilities.ts

Extract all inline database type checks (schema-aware, pagination style,
feature support sets, etc.) into a single source of truth. Adding a new
database type now requires updating only one file instead of 15+.
This commit is contained in:
t8y2
2026-05-07 02:36:50 +08:00
parent fde76d5576
commit 629bd02b0f
11 changed files with 153 additions and 155 deletions
+2 -8
View File
@@ -20,6 +20,7 @@ import {
import type { SqlCompletionColumn, SqlCompletionTable } from "@/lib/sqlCompletion";
import * as api from "@/lib/api";
import { isTauriRuntime } from "@/lib/tauriRuntime";
import { isSchemaAware } from "@/lib/databaseCapabilities";
const PINNED_TREE_NODES_STORAGE_KEY = "dbx-pinned-tree-nodes";
@@ -653,14 +654,7 @@ export const useConnectionStore = defineStore("connection", () => {
}
function isSchemaAwareDatabase(connectionId: string): boolean {
const dbType = getConfig(connectionId)?.db_type;
return (
dbType === "postgres" ||
dbType === "sqlserver" ||
dbType === "oracle" ||
dbType === "dameng" ||
dbType === "gaussdb"
);
return isSchemaAware(getConfig(connectionId)?.db_type);
}
async function listCompletionTables(connectionId: string, database: string): Promise<SqlCompletionTable[]> {