From d1720a1751232360fb4d953a0a2467580897d451 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Thu, 14 Mar 2024 14:51:49 +0800 Subject: [PATCH] Upstream Changes - 2 --- CHANGELOG.md | 3 +++ src/mysql/probe.rs | 2 +- src/postgres/probe.rs | 2 +- src/probe.rs | 4 ++-- src/sqlite/probe.rs | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 722153e..c68b1d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 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)