Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to SQLx v0.7 #114

Merged
merged 14 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 0.13.0 - Pending

### Features and upgrades

* Upgrade `sea-query` to `0.30` https://github.com/SeaQL/sea-schema/pull/114
* Upgrade `sea-query-binder` to `0.5` https://github.com/SeaQL/sea-schema/pull/114
* Upgrade `sqlx` to `0.7` https://github.com/SeaQL/sea-schema/pull/114

## 0.12.0 - 2023-07-20

+ 2023-03-22: `0.12.0-rc.1`
Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ members = [

[package]
name = "sea-schema"
version = "0.12.0"
version = "0.13.0"
authors = [ "Chris Tsang <tyt2y7@gmail.com>" ]
edition = "2021"
description = "🌿 SQL schema definition and discovery"
Expand All @@ -36,10 +36,10 @@ path = "src/lib.rs"
[dependencies]
futures = { version = "0.3", default-features = false, optional = true, features = ["alloc"] }
sea-schema-derive = { version = "0.2.0", path = "sea-schema-derive", default-features = false }
sea-query = { version = "0.29.0", default-features = false, features = ["derive"] }
sea-query-binder = { version = "0.4.0", default-features = false, optional = true }
sea-query = { version = "0.30.0", default-features = false, features = ["derive"] }
sea-query-binder = { version = "0.5.0", default-features = false, optional = true }
serde = { version = "1", default-features = false, optional = true, features = ["derive"] }
sqlx = { version = "0.6", default-features = false, optional = true }
sqlx = { version = "0.7", default-features = false, optional = true }
log = { version = "0.4", default-features = false, optional = true }

[features]
Expand Down Expand Up @@ -78,7 +78,7 @@ sqlx-sqlite = [
"sqlx/sqlite",
]
runtime-actix-native-tls = [
"sqlx/runtime-actix-native-tls",
"sqlx/runtime-tokio-native-tls",
"sea-query-binder/runtime-actix-native-tls",
]
runtime-async-std-native-tls = [
Expand All @@ -90,7 +90,7 @@ runtime-tokio-native-tls = [
"sea-query-binder/runtime-tokio-native-tls",
]
runtime-actix-rustls = [
"sqlx/runtime-actix-rustls",
"sqlx/runtime-tokio-rustls",
"sea-query-binder/runtime-actix-rustls",
]
runtime-async-std-rustls = [
Expand Down
2 changes: 1 addition & 1 deletion src/mysql/discovery/executor/real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl Executor {
debug_print!("{}, {:?}", sql, values);

sqlx::query_with(&sql, values)
.fetch_all(&mut self.pool.acquire().await?)
.fetch_all(&mut *self.pool.acquire().await?)
.await
}
}
2 changes: 1 addition & 1 deletion src/postgres/discovery/executor/real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl Executor {
debug_print!("{}, {:?}", sql, values);

sqlx::query_with(&sql, values)
.fetch_all(&mut self.pool.acquire().await?)
.fetch_all(&mut *self.pool.acquire().await?)
.await
}
}
6 changes: 3 additions & 3 deletions src/sqlite/executor/real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl Executor {
debug_print!("{}, {:?}", sql, values);

sqlx::query_with(&sql, values)
.fetch_all(&mut self.pool.acquire().await?)
.fetch_all(&mut *self.pool.acquire().await?)
.await
}

Expand All @@ -33,15 +33,15 @@ impl Executor {
debug_print!("{}, {:?}", sql, values);

sqlx::query_with(&sql, values)
.fetch_one(&mut self.pool.acquire().await?)
.fetch_one(&mut *self.pool.acquire().await?)
.await
}

pub async fn fetch_all_raw(&self, sql: String) -> Result<Vec<SqliteRow>, SqlxError> {
debug_print!("{}", sql);

sqlx::query(&sql)
.fetch_all(&mut self.pool.acquire().await?)
.fetch_all(&mut *self.pool.acquire().await?)
.await
}
}
2 changes: 1 addition & 1 deletion tests/discovery/mysql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ publish = false
async-std = { version = "1.8", features = [ "attributes", "tokio1" ] }
sea-schema = { path = "../../../", default-features = false, features = [ "with-serde", "sqlx-mysql", "runtime-async-std-native-tls", "discovery", "debug-print" ] }
serde_json = { version = "1" }
sqlx = { version = "0.6" }
sqlx = { version = "0.7" }
env_logger = { version = "0" }
log = { version = "0" }
2 changes: 1 addition & 1 deletion tests/discovery/postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ publish = false
async-std = { version = "1.8", features = [ "attributes", "tokio1" ] }
sea-schema = { path = "../../../", default-features = false, features = [ "with-serde", "sqlx-postgres", "runtime-async-std-native-tls", "discovery", "debug-print" ] }
serde_json = { version = "1" }
sqlx = { version = "0.6" }
sqlx = { version = "0.7" }
env_logger = { version = "0" }
log = { version = "0" }
2 changes: 1 addition & 1 deletion tests/discovery/sqlite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ publish = false
async-std = { version = "1.8", features = [ "attributes", "tokio1" ] }
sea-schema = { path = "../../../", default-features = false, features = [ "with-serde", "sqlx-sqlite", "runtime-async-std-native-tls", "discovery", "debug-print" ] }
serde_json = { version = "1" }
sqlx = { version = "0.6" }
sqlx = { version = "0.7" }
2 changes: 1 addition & 1 deletion tests/live/mysql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
async-std = { version = "1.8", features = [ "attributes", "tokio1" ] }
sea-schema = { path = "../../../", default-features = false, features = [ "sqlx-mysql", "runtime-async-std-native-tls", "discovery", "writer", "debug-print" ] }
serde_json = { version = "1" }
sqlx = { version = "0.6" }
sqlx = { version = "0.7" }
pretty_assertions = { version = "0.7" }
regex = { version = "1" }
env_logger = { version = "0" }
Expand Down
6 changes: 3 additions & 3 deletions tests/live/mysql/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async fn main() {
let sql = tbl_create_stmt.to_string(MysqlQueryBuilder);
println!("{};", sql);
println!();
sqlx::query(&sql).execute(&mut executor).await.unwrap();
sqlx::query(&sql).execute(&mut *executor).await.unwrap();
}

let schema_discovery = SchemaDiscovery::new(connection, "sea-schema");
Expand Down Expand Up @@ -98,12 +98,12 @@ async fn setup(base_url: &str, db_name: &str) -> Pool<MySql> {

let _drop_db_result = sqlx::query(&format!("DROP DATABASE IF EXISTS `{}`;", db_name))
.bind(db_name)
.execute(&mut connection)
.execute(&mut *connection)
.await
.unwrap();

let _create_db_result = sqlx::query(&format!("CREATE DATABASE `{}`;", db_name))
.execute(&mut connection)
.execute(&mut *connection)
.await
.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion tests/live/postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
async-std = { version = "1.8", features = [ "attributes", "tokio1" ] }
sea-schema = { path = "../../../", default-features = false, features = [ "sqlx-postgres", "runtime-async-std-native-tls", "discovery", "writer", "debug-print" ] }
serde_json = { version = "1" }
sqlx = { version = "0.6" }
sqlx = { version = "0.7" }
env_logger = { version = "0" }
log = { version = "0" }
pretty_assertions = { version = "0.7" }
10 changes: 5 additions & 5 deletions tests/live/postgres/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async fn main() {
let mut executor = connection.acquire().await.unwrap();

sqlx::query("CREATE EXTENSION IF NOT EXISTS citext")
.execute(&mut executor)
.execute(&mut *executor)
.await
.unwrap();

Expand All @@ -39,7 +39,7 @@ async fn main() {
.to_string(PostgresQueryBuilder);

sqlx::query(&create_enum_stmt)
.execute(&mut executor)
.execute(&mut *executor)
.await
.unwrap();

Expand All @@ -58,7 +58,7 @@ async fn main() {
let sql = tbl_create_stmt.to_string(PostgresQueryBuilder);
println!("{};", sql);
println!();
sqlx::query(&sql).execute(&mut executor).await.unwrap();
sqlx::query(&sql).execute(&mut *executor).await.unwrap();
}

let schema_discovery = SchemaDiscovery::new(connection, "public");
Expand Down Expand Up @@ -121,12 +121,12 @@ async fn setup(base_url: &str, db_name: &str) -> Pool<Postgres> {

let _drop_db_result = sqlx::query(&format!("DROP DATABASE IF EXISTS \"{}\";", db_name))
.bind(db_name)
.execute(&mut connection)
.execute(&mut *connection)
.await
.unwrap();

let _create_db_result = sqlx::query(&format!("CREATE DATABASE \"{}\";", db_name))
.execute(&mut connection)
.execute(&mut *connection)
.await
.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion tests/live/sqlite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sea-schema = { path = "../../../", default-features = false, features = [
"sqlite",
] }
serde_json = { version = "1" }
sqlx = { version = "0.6", features = [
sqlx = { version = "0.7", features = [
"sqlite",
"runtime-async-std-native-tls",
] }
Expand Down
28 changes: 14 additions & 14 deletions tests/live/sqlite/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ async fn test_001() -> DiscoveryResult<()> {

//DROP TABLES to ensure all tests pass
sqlx::query("DROP TABLE IF EXISTS Programming_Langs")
.fetch_all(&mut sqlite_pool.acquire().await.unwrap())
.fetch_all(&mut *sqlite_pool.acquire().await.unwrap())
.await
.unwrap();

sqlx::query("DROP TABLE IF EXISTS suppliers")
.fetch_all(&mut sqlite_pool.acquire().await.unwrap())
.fetch_all(&mut *sqlite_pool.acquire().await.unwrap())
.await
.unwrap();

sqlx::query("DROP TABLE IF EXISTS supplier_groups")
.fetch_all(&mut sqlite_pool.acquire().await.unwrap())
.fetch_all(&mut *sqlite_pool.acquire().await.unwrap())
.await
.unwrap();

Expand Down Expand Up @@ -94,17 +94,17 @@ async fn test_001() -> DiscoveryResult<()> {

//DROP TABLES to ensure all tests pass
sqlx::query("DROP TABLE IF EXISTS Programming_Langs")
.fetch_all(&mut sqlite_pool.acquire().await.unwrap())
.fetch_all(&mut *sqlite_pool.acquire().await.unwrap())
.await
.unwrap();

sqlx::query("DROP TABLE IF EXISTS suppliers")
.fetch_all(&mut sqlite_pool.acquire().await.unwrap())
.fetch_all(&mut *sqlite_pool.acquire().await.unwrap())
.await
.unwrap();

sqlx::query("DROP TABLE IF EXISTS supplier_groups")
.fetch_all(&mut sqlite_pool.acquire().await.unwrap())
.fetch_all(&mut *sqlite_pool.acquire().await.unwrap())
.await
.unwrap();

Expand Down Expand Up @@ -164,37 +164,37 @@ async fn test_001() -> DiscoveryResult<()> {
.to_owned();

sqlx::query(&create_table.to_string(SqliteQueryBuilder))
.fetch_all(&mut sqlite_pool.acquire().await.unwrap())
.fetch_all(&mut *sqlite_pool.acquire().await.unwrap())
.await
.unwrap();

sqlx::query(&insert_into_table.to_string(SqliteQueryBuilder))
.fetch_all(&mut sqlite_pool.acquire().await.unwrap())
.fetch_all(&mut *sqlite_pool.acquire().await.unwrap())
.await
.unwrap();

sqlx::query(&table_create_supplier_groups.to_string(SqliteQueryBuilder))
.fetch_all(&mut sqlite_pool.acquire().await.unwrap())
.fetch_all(&mut *sqlite_pool.acquire().await.unwrap())
.await
.unwrap();

sqlx::query(&table_create_suppliers.to_string(SqliteQueryBuilder))
.fetch_all(&mut sqlite_pool.acquire().await.unwrap())
.fetch_all(&mut *sqlite_pool.acquire().await.unwrap())
.await
.unwrap();

sqlx::query(&insert_into_supplier_groups.to_string(SqliteQueryBuilder))
.fetch_all(&mut sqlite_pool.acquire().await.unwrap())
.fetch_all(&mut *sqlite_pool.acquire().await.unwrap())
.await
.unwrap();

sqlx::query(&insert_into_suppliers.to_string(SqliteQueryBuilder))
.fetch_all(&mut sqlite_pool.acquire().await.unwrap())
.fetch_all(&mut *sqlite_pool.acquire().await.unwrap())
.await
.unwrap();

sqlx::query(&create_index.to_string(SqliteQueryBuilder))
.fetch_all(&mut sqlite_pool.acquire().await.unwrap())
.fetch_all(&mut *sqlite_pool.acquire().await.unwrap())
.await
.unwrap();

Expand Down Expand Up @@ -259,7 +259,7 @@ async fn test_002() -> DiscoveryResult<()> {
let sql = tbl_create_stmt.to_string(SqliteQueryBuilder);
println!("{};", sql);
println!();
sqlx::query(&sql).execute(&mut executor).await.unwrap();
sqlx::query(&sql).execute(&mut *executor).await.unwrap();
}

let schema_discovery = SchemaDiscovery::new(connection);
Expand Down
2 changes: 1 addition & 1 deletion tests/writer/mysql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ publish = false
async-std = { version = "1.8", features = [ "attributes", "tokio1" ] }
sea-schema = { path = "../../../", default-features = false, features = [ "sqlx-mysql", "runtime-async-std-native-tls", "discovery", "writer", "debug-print" ] }
serde_json = { version = "1" }
sqlx = { version = "0.6" }
sqlx = { version = "0.7" }
env_logger = { version = "0" }
log = { version = "0" }
2 changes: 1 addition & 1 deletion tests/writer/postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ pretty_assertions = { version = "0.7" }
async-std = { version = "1.8", features = [ "attributes", "tokio1" ] }
sea-schema = { path = "../../../", default-features = false, features = [ "sqlx-postgres", "runtime-async-std-native-tls", "discovery", "writer", "debug-print" ] }
serde_json = { version = "1" }
sqlx = { version = "0.6" }
sqlx = { version = "0.7" }
env_logger = { version = "0" }
log = { version = "0" }
2 changes: 1 addition & 1 deletion tests/writer/sqlite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ publish = false
async-std = { version = "1.8", features = [ "attributes", "tokio1" ] }
sea-schema = { path = "../../../", default-features = false, features = [ "sqlx-sqlite", "runtime-async-std-native-tls", "discovery", "writer", "debug-print" ] }
serde_json = { version = "1" }
sqlx = { version = "0.6" }
sqlx = { version = "0.7" }