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

@@ -204,6 +204,10 @@ describe("buildSelectAllSql", () => {
expect(buildSelectAllSql("postgres", { schema: "public", tableName: "users" })).toBe('SELECT * FROM "public"."users"');
});
it("preserves the Phoenix schema for new-query prefill", () => {
expect(buildSelectAllSql("jdbc", { schema: "APP", tableName: "USERS" }, '"', "phoenix")).toBe('SELECT * FROM "APP"."USERS"');
});
it("bracket-quotes a SQL Server table", () => {
expect(buildSelectAllSql("sqlserver", { schema: "dbo", tableName: "users" })).toBe("SELECT * FROM [dbo].[users]");
expect(buildSelectAllSql("sqlserver", { tableName: "users" })).toBe("SELECT * FROM [users]");
@@ -258,6 +262,20 @@ describe("resolveNewQueryInitialSql", () => {
).toBe('SELECT * FROM "public"."users"');
});
it("passes the Phoenix driver profile into the initial SQL builder", () => {
expect(
resolveNewQueryInitialSql({
activeTab: dataTab({ schema: "APP", tableMeta: { schema: "APP", tableName: "USERS", columns: [], primaryKeys: [] } }),
prefillEnabled: true,
targetConnectionId: "conn-1",
targetDatabase: "app_db",
databaseType: "jdbc",
driverProfile: "phoenix",
identifierQuote: '"',
}),
).toBe('SELECT * FROM "APP"."USERS"');
});
it("leaves new queries empty when the setting is disabled", () => {
expect(
resolveNewQueryInitialSql({