Skip to content

Commit

Permalink
Revert "fix: handle when referential_constraints_subquery.table_name …
Browse files Browse the repository at this point in the history
…is null (SeaQL#125)"

This reverts commit f139abc.
  • Loading branch information
28Smiles committed Apr 21, 2024
1 parent 0806dba commit be8ffe2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/postgres/discovery/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl SchemaDiscovery {
.executor
.fetch_all(
self.query
.query_table_constraints(schema.clone(), table.clone()),
.query_table_constriants(schema.clone(), table.clone()),
)
.await?;

Expand Down
12 changes: 4 additions & 8 deletions src/postgres/query/constraints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub struct TableConstraintsQueryResult {
}

impl SchemaQueryBuilder {
pub fn query_table_constraints(
pub fn query_table_constriants(
&self,
schema: SeaRc<dyn Iden>,
table: SeaRc<dyn Iden>,
Expand Down Expand Up @@ -197,13 +197,9 @@ impl SchemaQueryBuilder {
Expr::col((Schema::TableConstraints, Tcf::TableSchema)).eq(schema.to_string()),
)
.and_where(Expr::col((Schema::TableConstraints, Tcf::TableName)).eq(table.to_string()))
.cond_where(
Condition::any()
.add(Expr::col((rcsq.clone(), Kcuf::TableName)).is_null())
.add(
Expr::col((rcsq.clone(), Kcuf::TableName))
.not_in_subquery(select_base_table_and_view()),
),
.and_where(
Expr::col((rcsq.clone(), Kcuf::TableName))
.not_in_subquery(select_base_table_and_view()),
)
.order_by((Schema::TableConstraints, Tcf::ConstraintName), Order::Asc)
.order_by((Schema::KeyColumnUsage, Kcuf::OrdinalPosition), Order::Asc)
Expand Down

0 comments on commit be8ffe2

Please sign in to comment.