Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Apr 24, 2023
1 parent d615448 commit 5329fb2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/postgres/query/constraints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub use referential_constraints::*;
pub use table_constraints::*;

use super::{InformationSchema, SchemaQueryBuilder};
use crate::{postgres::query::select_table_and_view, sqlx_types::postgres::PgRow};
use crate::{postgres::query::select_base_table_and_view, sqlx_types::postgres::PgRow};
use sea_query::{Alias, Condition, Expr, Iden, JoinType, Order, Query, SeaRc, SelectStatement};

#[derive(Debug, Default)]
Expand Down Expand Up @@ -163,7 +163,8 @@ impl SchemaQueryBuilder {
)
.and_where(Expr::col((Schema::TableConstraints, Tcf::TableName)).eq(table.to_string()))
.and_where(
Expr::col((rcsq.clone(), Kcuf::TableName)).not_in_subquery(select_table_and_view()),
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
2 changes: 1 addition & 1 deletion src/postgres/query/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub enum InformationSchema {
ConstraintColumnUsage,
}

pub(crate) fn select_table_and_view() -> SelectStatement {
pub(crate) fn select_base_table_and_view() -> SelectStatement {
#[derive(Debug, Iden)]
enum PgClass {
Table,
Expand Down
6 changes: 4 additions & 2 deletions src/postgres/query/table.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{select_table_and_view, InformationSchema, SchemaQueryBuilder};
use super::{select_base_table_and_view, InformationSchema, SchemaQueryBuilder};
use crate::sqlx_types::postgres::PgRow;
use sea_query::{Expr, Iden, Query, SeaRc, SelectStatement};

Expand Down Expand Up @@ -46,7 +46,9 @@ impl SchemaQueryBuilder {
.from((InformationSchema::Schema, InformationSchema::Tables))
.and_where(Expr::col(TablesFields::TableSchema).eq(schema.to_string()))
.and_where(Expr::col(TablesFields::TableType).eq(TableType::BaseTable.to_string()))
.and_where(Expr::col(TablesFields::TableName).not_in_subquery(select_table_and_view()))
.and_where(
Expr::col(TablesFields::TableName).not_in_subquery(select_base_table_and_view()),
)
.take()
}
}
Expand Down

0 comments on commit 5329fb2

Please sign in to comment.