Skip to content

Commit

Permalink
Upstream Changes - 2 (#127)
Browse files Browse the repository at this point in the history
* Upstream Changes - 2

* optional dependency
  • Loading branch information
billy1624 authored Mar 19, 2024
1 parent e5c7aac commit 9e14866
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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
24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,27 @@ sqlx-sqlite = [
"sqlx/sqlite",
]
runtime-actix-native-tls = [
"sqlx/runtime-tokio-native-tls",
"sea-query-binder/runtime-actix-native-tls",
"sqlx?/runtime-tokio-native-tls",
"sea-query-binder?/runtime-actix-native-tls",
]
runtime-async-std-native-tls = [
"sqlx/runtime-async-std-native-tls",
"sea-query-binder/runtime-async-std-native-tls",
"sqlx?/runtime-async-std-native-tls",
"sea-query-binder?/runtime-async-std-native-tls",
]
runtime-tokio-native-tls = [
"sqlx/runtime-tokio-native-tls",
"sea-query-binder/runtime-tokio-native-tls",
"sqlx?/runtime-tokio-native-tls",
"sea-query-binder?/runtime-tokio-native-tls",
]
runtime-actix-rustls = [
"sqlx/runtime-tokio-rustls",
"sea-query-binder/runtime-actix-rustls",
"sqlx?/runtime-tokio-rustls",
"sea-query-binder?/runtime-actix-rustls",
]
runtime-async-std-rustls = [
"sqlx/runtime-async-std-rustls",
"sea-query-binder/runtime-async-std-rustls",
"sqlx?/runtime-async-std-rustls",
"sea-query-binder?/runtime-async-std-rustls",
]
runtime-tokio-rustls = [
"sqlx/runtime-tokio-rustls",
"sea-query-binder/runtime-tokio-rustls",
"sqlx?/runtime-tokio-rustls",
"sea-query-binder?/runtime-tokio-rustls",
]
with-serde = ["serde"]
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 9e14866

Please sign in to comment.