From 9e148660774dc2a71a74154b80166312290b8d6a Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 19 Mar 2024 16:57:09 +0800 Subject: [PATCH] Upstream Changes - 2 (#127) * Upstream Changes - 2 * optional dependency --- CHANGELOG.md | 3 +++ Cargo.toml | 24 ++++++++++++------------ src/mysql/probe.rs | 2 +- src/postgres/probe.rs | 2 +- src/probe.rs | 4 ++-- src/sqlite/probe.rs | 2 +- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c2f27c..704c9da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Cargo.toml b/Cargo.toml index fe5762f..000e7f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] diff --git a/src/mysql/probe.rs b/src/mysql/probe.rs index 871df1c..de14152 100644 --- a/src/mysql/probe.rs +++ b/src/mysql/probe.rs @@ -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)) diff --git a/src/postgres/probe.rs b/src/postgres/probe.rs index 0067674..96fbbd4 100644 --- a/src/postgres/probe.rs +++ b/src/postgres/probe.rs @@ -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)) diff --git a/src/probe.rs b/src/probe.rs index fd178f5..01efb1a 100644 --- a/src/probe.rs +++ b/src/probe.rs @@ -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(&self, table: T) -> SelectStatement where T: AsRef, { - 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) diff --git a/src/sqlite/probe.rs b/src/sqlite/probe.rs index 22f7370..909859d 100644 --- a/src/sqlite/probe.rs +++ b/src/sqlite/probe.rs @@ -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)