Skip to content

Commit

Permalink
PostgreSQL query non-key foreign key info (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 authored May 12, 2022
1 parent c598779 commit 00429f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/postgres/query/constraints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ impl SchemaQueryBuilder {
(Schema::ReferentialConstraints, RefC::DeleteRule),
])
.columns(vec![
(Schema::KeyColumnUsage, Kcuf::TableName),
(Schema::KeyColumnUsage, Kcuf::ColumnName),
(Schema::ConstraintColumnUsage, Kcuf::TableName),
(Schema::ConstraintColumnUsage, Kcuf::ColumnName),
])
.from((Schema::Schema, Schema::ReferentialConstraints))
.left_join(
(Schema::Schema, Schema::KeyColumnUsage),
Expr::tbl(Schema::ReferentialConstraints, RefC::UniqueConstraintName)
.equals(Schema::KeyColumnUsage, Kcuf::ConstraintName),
(Schema::Schema, Schema::ConstraintColumnUsage),
Expr::tbl(Schema::ReferentialConstraints, RefC::ConstraintName)
.equals(Schema::ConstraintColumnUsage, Kcuf::ConstraintName),
)
.take(),
rcsq.clone(),
Expand Down
1 change: 1 addition & 0 deletions src/postgres/query/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ pub enum InformationSchema {
ReferentialConstraints,
Tables,
TableConstraints,
ConstraintColumnUsage,
}

0 comments on commit 00429f3

Please sign in to comment.