Skip to content

Commit ce8c887

Browse files
authored
fix: use current schema name in getProperties method
1 parent 1746d07 commit ce8c887

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/dialects/postgres.parser.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class PostgresParser extends BaseDatabaseParser {
121121
this.connectionOptions.database,
122122
schemaName,
123123
tableName,
124-
await this.getProperties(tableName),
124+
await this.getProperties(tableName, schemaName),
125125
);
126126

127127
return resourceMetadata;
@@ -137,7 +137,7 @@ export class PostgresParser extends BaseDatabaseParser {
137137
return resources.filter(Boolean) as ResourceMetadata[];
138138
}
139139

140-
public async getProperties(table: string) {
140+
public async getProperties(table: string, schemaName: string) {
141141
const query = this.knex
142142
.from('information_schema.columns as col')
143143
.select(
@@ -156,7 +156,7 @@ export class PostgresParser extends BaseDatabaseParser {
156156
.on('tco.constraint_name', 'kcu.constraint_name')
157157
.on('tco.constraint_schema', 'kcu.constraint_schema')
158158
.onVal('tco.constraint_type', 'PRIMARY KEY'))
159-
.where('col.table_schema', 'public')
159+
.where('col.table_schema', schemaName)
160160
.where('col.table_name', table);
161161

162162
const columns = await query;

0 commit comments

Comments
 (0)