Skip to content

Commit

Permalink
fix(postgres): fix query for loading all foreign keys from existing s…
Browse files Browse the repository at this point in the history
…chema

Related: #5364
  • Loading branch information
B4nan committed Mar 21, 2024
1 parent a24d80d commit 2eb85d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/postgresql/src/PostgreSqlSchemaHelper.ts
Expand Up @@ -222,7 +222,7 @@ export class PostgreSqlSchemaHelper extends SchemaHelper {
on rco.unique_constraint_schema = rel_kcu.constraint_schema
and rco.unique_constraint_name = rel_kcu.constraint_name
and kcu.ordinal_position = rel_kcu.ordinal_position
where (${tables.map(t => `tco.table_name = '${t.table_name}' and tco.table_schema = '${t.schema_name}' and tco.constraint_schema = '${t.schema_name}'`).join(' or ')})
where (${tables.map(t => `(tco.table_name = '${t.table_name}' and tco.table_schema = '${t.schema_name}' and tco.constraint_schema = '${t.schema_name}')`).join(' or ')})
and tco.constraint_type = 'FOREIGN KEY'
order by kcu.table_schema, kcu.table_name, kcu.ordinal_position, kcu.constraint_name`;
const allFks = await connection.execute<any[]>(sql);
Expand Down

0 comments on commit 2eb85d5

Please sign in to comment.