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: sync saved sql file connection on tab connection change
t8y22fc835060e31
diff --git a/apps/desktop/src/stores/queryStore.ts b/apps/desktop/src/stores/queryStore.tsindex 47386e8b87..260e62723d 100644--- a/apps/desktop/src/stores/queryStore.ts+++ b/apps/desktop/src/stores/queryStore.ts@@ -38,6 +38,7 @@ import { decodeQueryResultArchive, encodeQueryResultArchive, type DecodedQueryReimport * as api from "@/lib/api";import { useConnectionStore } from "@/stores/connectionStore";import { useSettingsStore } from "@/stores/settingsStore";+import { useSavedSqlStore } from "@/stores/savedSqlStore";import type { SavedSqlFile } from "@/types/database";const STORAGE_KEY = "dbx-open-tabs";@@ -942,6 +943,22 @@ export const useQueryStore = defineStore("query", () => {tab.resultSortedSql = undefined;clearExplain(tab);tab.tableMeta = undefined;++ // Sync connection change back to the saved SQL file if this tab is linked+ if (tab.savedSqlId) {+ const savedSqlStore = useSavedSqlStore();+ const existing = savedSqlStore.getFile(tab.savedSqlId);+ if (existing) {+ void savedSqlStore.saveFile({+ id: existing.id,+ connectionId,+ name: existing.name,+ database,+ schema: existing.schema,+ sql: existing.sql,+ });+ }+ }}function setTableMeta(id: string, meta: NonNullable<QueryTab["tableMeta"]>) {diff --git a/apps/desktop/src/stores/savedSqlStore.ts b/apps/desktop/src/stores/savedSqlStore.tsindex 07e97cd039..e32badefd9 100644--- a/apps/desktop/src/stores/savedSqlStore.ts+++ b/apps/desktop/src/stores/savedSqlStore.ts@@ -196,6 +196,7 @@ export const useSavedSqlStore = defineStore("savedSql", () => {database: input.database,schema: input.schema,sql: input.sql,+ connectionId: input.connectionId,updatedAt: timestamp,}: {