default schema refactor

This commit is contained in:
Jan Prochazka
2024-09-19 13:41:49 +02:00
parent 9eb27f5e92
commit 8c3c32aeba
9 changed files with 38 additions and 11 deletions

View File

@@ -273,10 +273,13 @@ const drivers = driverBases.map(driverBase => ({
pool,
'select oid as "object_id", nspname as "schema_name" from pg_catalog.pg_namespace'
);
const defaultSchemaRows = await this.query(pool, 'SHOW SEARCH_PATH;');
const searchPath = defaultSchemaRows.rows[0]?.search_path?.replace('"$user",', '')?.trim();
const schemas = schemaRows.rows.map(x => ({
schemaName: x.schema_name,
objectId: x.object_id,
isDefault: x.schema_name == searchPath,
}));
return schemas;