Skip to content

Commit

Permalink
Upstream Changes - 2
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Mar 14, 2024
1 parent f5f9c49 commit d1720a1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Breaking changes

* `SchemaProbe::query_tables(..)` changed to `SchemaProbe::query_tables(&self, ..)` https://github.com/SeaQL/sea-schema/pull/127
* `SchemaProbe::has_table(..)` changed to `SchemaProbe::has_table(&self, ..)` https://github.com/SeaQL/sea-schema/pull/126
* `SchemaProbe::has_column(..)` changed to `SchemaProbe::has_column(&self, ..)` https://github.com/SeaQL/sea-schema/pull/126
* `SchemaProbe::has_index(..)` changed to `SchemaProbe::has_index(&self, ..)` https://github.com/SeaQL/sea-schema/pull/126

## 0.14.2 - 2024-01-18

Expand Down
2 changes: 1 addition & 1 deletion src/mysql/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ impl SchemaProbe for MySql {
Expr::cust("DATABASE()")
}

fn query_tables() -> SelectStatement {
fn query_tables(&self) -> SelectStatement {
Query::select()
.expr_as(Expr::col(TablesFields::TableName), TablesFields::TableName)
.from((Schema::Schema, Schema::Tables))
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ impl SchemaProbe for Postgres {
Expr::cust("CURRENT_SCHEMA()")
}

fn query_tables() -> SelectStatement {
fn query_tables(&self) -> SelectStatement {
Query::select()
.expr_as(Expr::col(TablesFields::TableName), TablesFields::TableName)
.from((Schema::Schema, Schema::Tables))
Expand Down
4 changes: 2 additions & 2 deletions src/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use sea_query::{Condition, Expr, Iden, Query, SelectStatement, SimpleExpr};
pub trait SchemaProbe {
fn get_current_schema() -> SimpleExpr;

fn query_tables() -> SelectStatement;
fn query_tables(&self) -> SelectStatement;

fn has_table<T>(&self, table: T) -> SelectStatement
where
T: AsRef<str>,
{
let mut subquery = Self::query_tables();
let mut subquery = self.query_tables();
subquery.cond_where(Expr::col(Schema::TableName).eq(table.as_ref()));
Query::select()
.expr_as(Expr::cust("COUNT(*) > 0"), Has::Table)
Expand Down
2 changes: 1 addition & 1 deletion src/sqlite/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ impl SchemaProbe for Sqlite {
unimplemented!()
}

fn query_tables() -> SelectStatement {
fn query_tables(&self) -> SelectStatement {
Query::select()
.expr_as(Expr::col(SqliteSchema::Name), Schema::TableName)
.from(SqliteMaster)
Expand Down

0 comments on commit d1720a1

Please sign in to comment.