fix(phoenix): preserve schema in all table references

This commit is contained in:
jearhe authored and GitHub committed 2026-08-21 10:18:56 +08:00
1 parent e139f63953
commit f2e13922a2
18 files changed
+200 -9

No files matched your search

@@ -1719,7 +1719,7 @@ async function loadTemplateContext(allowView = false) {
}
const identifierQuote = connectionStore.connectionIdentifierQuote(node.connectionId);
return { node, dbType, identifierQuote, tableSchema, columns, tableType };
return { node, dbType, driverProfile: config?.driver_profile, identifierQuote, tableSchema, columns, tableType };
}
function openSqlTemplateTab(connectionId: string, database: string, schema: string | undefined, catalog: string | undefined, sql: string, title?: string) {
@@ -1733,6 +1733,7 @@ async function newSelectTemplate() {
if (!context) return;
const sql = buildTableSelectTemplate({
databaseType: context.dbType,
driverProfile: context.driverProfile,
identifierQuote: context.identifierQuote,
catalog: context.node.catalog,
database: context.node.database,
@@ -1752,6 +1753,7 @@ async function newInsertTemplate() {
if (!context) return;
const sql = buildTableInsertTemplate({
databaseType: context.dbType,
driverProfile: context.driverProfile,
identifierQuote: context.identifierQuote,
catalog: context.node.catalog,
database: context.node.database,
@@ -1772,6 +1774,7 @@ async function newUpdateTemplate() {
if (!context) return;
const sql = buildTableUpdateTemplate({
databaseType: context.dbType,
driverProfile: context.driverProfile,
identifierQuote: context.identifierQuote,
catalog: context.node.catalog,
database: context.node.database,
@@ -1791,6 +1794,7 @@ async function newDeleteTemplate() {
if (!context) return;
const sql = buildTableDeleteTemplate({
databaseType: context.dbType,
driverProfile: context.driverProfile,
identifierQuote: context.identifierQuote,
catalog: context.node.catalog,
database: context.node.database,
@@ -208,6 +208,10 @@ function currentDatabaseType(): DatabaseType | undefined {
return activeNode.value.connectionId ? effectiveDatabaseTypeForConnection(connectionStore.getConfig(activeNode.value.connectionId)) : undefined;
}
function currentDriverProfile(): string | undefined {
return activeNode.value.connectionId ? connectionStore.getConfig(activeNode.value.connectionId)?.driver_profile : undefined;
}
function getIconInfo(node: TreeNode): { icon: any; colorClass: string } | null {
switch (node.type) {
case "connection":
@@ -1116,6 +1120,7 @@ function tableReferenceDragPayload(): QueryEditorTableReferencePayload | null {
database: activeNode.value.database,
referenceType: "database",
databaseType: currentDatabaseType(),
driverProfile: currentDriverProfile(),
});
}
if (activeNode.value.type === "column") {
@@ -1128,6 +1133,7 @@ function tableReferenceDragPayload(): QueryEditorTableReferencePayload | null {
tableName: activeNode.value.tableName,
columnName,
databaseType: currentDatabaseType(),
driverProfile: currentDriverProfile(),
});
}
const payload = createTableReferencePayload({
@@ -1136,6 +1142,7 @@ function tableReferenceDragPayload(): QueryEditorTableReferencePayload | null {
schema: activeNode.value.schema,
tableName: activeNode.value.label,
databaseType: currentDatabaseType(),
driverProfile: currentDriverProfile(),
});
return payload;
}