fix(sql): restore SQL file schema for sidebar locate

This commit is contained in:
Melody Ruch authored and GitHub committed 2026-09-01 16:21:40 +08:00
1 parent 440c41f5b9
commit e9a90173a6
11 files changed
+175 -53

No files matched your search

+5 -1
View File
@@ -1920,7 +1920,7 @@ export const useQueryStore = defineStore("query", () => {
});
}
function openExternalSqlFile(connectionId: string, database: string, path: string, sql: string, version?: QueryTab["externalSqlFileVersion"], catalog?: string) {
function openExternalSqlFile(connectionId: string, database: string, path: string, sql: string, version?: QueryTab["externalSqlFileVersion"], catalog?: string, schema?: string) {
const normalizedPath = normalizeExternalSqlPath(path);
const existing = tabs.value.find((tab) => tab.mode === "query" && tab.externalSqlPath && normalizeExternalSqlPath(tab.externalSqlPath) === normalizedPath);
if (existing) {
@@ -1939,6 +1939,10 @@ export const useQueryStore = defineStore("query", () => {
connectionId,
database,
catalog,
// Restoring the schema keeps the reopened file on the namespace it was
// saved from. Without it the tab has no schema, so sidebar locate and the
// metadata paths fall back to the connection default (issue #7648).
schema,
sql,
originalSql: sql,
externalSqlPath: path,