diff --git a/Cargo.toml b/Cargo.toml index 06f711b6c..b8c3192b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,12 +34,12 @@ tracing = { version = "0.1", default-features = false, features = ["attributes", rust_decimal = { version = "1", default-features = false, optional = true } bigdecimal = { version = "0.3", default-features = false, optional = true } sea-orm-macros = { version = "0.12.0-rc.4", path = "sea-orm-macros", default-features = false, features = ["strum"] } -sea-query = { version = "0.29.0", default-features = false, features = ["thread-safe", "hashable-value", "backend-mysql", "backend-postgres", "backend-sqlite"] } -sea-query-binder = { version = "0.4.0-rc.2", default-features = false, optional = true } +sea-query = { version = "0.30.0", default-features = false, features = ["thread-safe", "hashable-value", "backend-mysql", "backend-postgres", "backend-sqlite"] } +sea-query-binder = { version = "0.5.0", default-features = false, optional = true } strum = { version = "0.25", default-features = false } serde = { version = "1.0", default-features = false } serde_json = { version = "1.0", default-features = false, optional = true } -sqlx = { version = "0.6", default-features = false, optional = true } +sqlx = { version = "0.7", default-features = false, optional = true } uuid = { version = "1", default-features = false, optional = true } ouroboros = { version = "0.17", default-features = false } url = { version = "2.2", default-features = false } @@ -78,7 +78,7 @@ macros = ["sea-orm-macros/derive"] mock = [] with-json = ["serde_json", "sea-query/with-json", "chrono?/serde", "time?/serde", "uuid?/serde", "sea-query-binder?/with-json", "sqlx?/json"] with-chrono = ["chrono", "sea-query/with-chrono", "sea-query-binder?/with-chrono", "sqlx?/chrono"] -with-rust_decimal = ["rust_decimal", "sea-query/with-rust_decimal", "sea-query-binder?/with-rust_decimal", "sqlx?/decimal"] +with-rust_decimal = ["rust_decimal", "sea-query/with-rust_decimal", "sea-query-binder?/with-rust_decimal", "sqlx?/rust_decimal"] with-bigdecimal = ["bigdecimal", "sea-query/with-bigdecimal", "sea-query-binder?/with-bigdecimal", "sqlx?/bigdecimal"] with-uuid = ["uuid", "sea-query/with-uuid", "sea-query-binder?/with-uuid", "sqlx?/uuid"] with-time = ["time", "sea-query/with-time", "sea-query-binder?/with-time", "sqlx?/time"] @@ -102,12 +102,12 @@ runtime-async-std-rustls = [ ] runtime-actix = [] runtime-actix-native-tls = [ - "sqlx?/runtime-actix-native-tls", + "sqlx?/runtime-tokio-native-tls", "sea-query-binder?/runtime-actix-native-tls", "runtime-actix", ] runtime-actix-rustls = [ - "sqlx?/runtime-actix-rustls", + "sqlx?/runtime-tokio-rustls", "sea-query-binder?/runtime-actix-rustls", "runtime-actix", ] diff --git a/sea-orm-cli/Cargo.toml b/sea-orm-cli/Cargo.toml index 9f393a95a..7dd2e957c 100644 --- a/sea-orm-cli/Cargo.toml +++ b/sea-orm-cli/Cargo.toml @@ -38,8 +38,8 @@ clap = { version = "4.3", features = ["env", "derive"], optional = true } dotenvy = { version = "0.15", default-features = false, optional = true } async-std = { version = "1.9", default-features = false, features = ["attributes", "tokio1"], optional = true } sea-orm-codegen = { version = "=0.12.0-rc.4", path = "../sea-orm-codegen", default-features = false, optional = true } -sea-schema = { version = "0.12.0-rc.2" } -sqlx = { version = "0.6", default-features = false, features = ["mysql", "postgres"], optional = true } +sea-schema = { version = "0.14.0" } +sqlx = { version = "0.7", default-features = false, features = ["mysql", "postgres"], optional = true } tracing-subscriber = { version = "0.3.17", default-features = false, features = ["env-filter", "fmt"] } tracing = { version = "0.1", default-features = false } url = { version = "2.2", default-features = false } @@ -54,9 +54,9 @@ smol = "1.2.5" default = ["codegen", "cli", "runtime-async-std-native-tls", "async-std"] codegen = ["sea-schema/sqlx-all", "sea-orm-codegen"] cli = ["clap", "dotenvy"] -runtime-actix-native-tls = ["sqlx/runtime-actix-native-tls", "sea-schema/runtime-actix-native-tls"] +runtime-actix-native-tls = ["sqlx/runtime-tokio-native-tls", "sea-schema/runtime-actix-native-tls"] runtime-async-std-native-tls = ["sqlx/runtime-async-std-native-tls", "sea-schema/runtime-async-std-native-tls"] runtime-tokio-native-tls = ["sqlx/runtime-tokio-native-tls", "sea-schema/runtime-tokio-native-tls"] -runtime-actix-rustls = ["sqlx/runtime-actix-rustls", "sea-schema/runtime-actix-rustls"] +runtime-actix-rustls = ["sqlx/runtime-tokio-rustls", "sea-schema/runtime-actix-rustls"] runtime-async-std-rustls = ["sqlx/runtime-async-std-rustls", "sea-schema/runtime-async-std-rustls"] runtime-tokio-rustls = ["sqlx/runtime-tokio-rustls", "sea-schema/runtime-tokio-rustls"] diff --git a/sea-orm-cli/src/commands/generate.rs b/sea-orm-cli/src/commands/generate.rs index 7de19d9aa..934f91a8d 100644 --- a/sea-orm-cli/src/commands/generate.rs +++ b/sea-orm-cli/src/commands/generate.rs @@ -112,7 +112,7 @@ pub async fn run_generate_command( let connection = connect::(max_connections, url.as_str(), None).await?; let schema_discovery = SchemaDiscovery::new(connection, database_name); - let schema = schema_discovery.discover().await; + let schema = schema_discovery.discover().await?; let table_stmts = schema .tables .into_iter() @@ -148,7 +148,7 @@ pub async fn run_generate_command( let connection = connect::(max_connections, url.as_str(), Some(schema)).await?; let schema_discovery = SchemaDiscovery::new(connection, schema); - let schema = schema_discovery.discover().await; + let schema = schema_discovery.discover().await?; let table_stmts = schema .tables .into_iter() diff --git a/sea-orm-codegen/Cargo.toml b/sea-orm-codegen/Cargo.toml index 1a0a2c7da..7a0ca52f1 100644 --- a/sea-orm-codegen/Cargo.toml +++ b/sea-orm-codegen/Cargo.toml @@ -17,7 +17,7 @@ name = "sea_orm_codegen" path = "src/lib.rs" [dependencies] -sea-query = { version = "0.29.0-rc.2", default-features = false, features = ["thread-safe"] } +sea-query = { version = "0.30.0", default-features = false, features = ["thread-safe"] } syn = { version = "2", default-features = false, features = ["parsing", "proc-macro", "derive", "printing"] } quote = { version = "1", default-features = false } heck = { version = "0.4", default-features = false } diff --git a/sea-orm-migration/Cargo.toml b/sea-orm-migration/Cargo.toml index 22b279e5c..58c7cafee 100644 --- a/sea-orm-migration/Cargo.toml +++ b/sea-orm-migration/Cargo.toml @@ -25,7 +25,7 @@ clap = { version = "4.3", features = ["env", "derive"], optional = true } dotenvy = { version = "0.15", default-features = false, optional = true } sea-orm = { version = "0.12.0-rc.4", path = "../", default-features = false, features = ["macros"] } sea-orm-cli = { version = "0.12.0-rc.4", path = "../sea-orm-cli", default-features = false, optional = true } -sea-schema = { version = "0.12.0-rc.2" } +sea-schema = { version = "0.14.0" } tracing = { version = "0.1", default-features = false, features = ["log"] } tracing-subscriber = { version = "0.3.17", default-features = false, features = ["env-filter", "fmt"] } futures = { version = "0.3", default-features = false, features = ["std"] } diff --git a/src/database/transaction.rs b/src/database/transaction.rs index e228a638a..14765b214 100644 --- a/src/database/transaction.rs +++ b/src/database/transaction.rs @@ -312,6 +312,7 @@ impl ConnectionTrait for DatabaseTransaction { #[cfg(feature = "sqlx-mysql")] InnerConnection::MySql(conn) => { let query = crate::driver::sqlx_mysql::sqlx_query(&stmt); + let conn: &mut sqlx::MySqlConnection = &mut *conn; crate::metric::metric!(self.metric_callback, &stmt, { query.execute(conn).await.map(Into::into) }) @@ -320,6 +321,7 @@ impl ConnectionTrait for DatabaseTransaction { #[cfg(feature = "sqlx-postgres")] InnerConnection::Postgres(conn) => { let query = crate::driver::sqlx_postgres::sqlx_query(&stmt); + let conn: &mut sqlx::PgConnection = &mut *conn; crate::metric::metric!(self.metric_callback, &stmt, { query.execute(conn).await.map(Into::into) }) @@ -328,6 +330,7 @@ impl ConnectionTrait for DatabaseTransaction { #[cfg(feature = "sqlx-sqlite")] InnerConnection::Sqlite(conn) => { let query = crate::driver::sqlx_sqlite::sqlx_query(&stmt); + let conn: &mut sqlx::SqliteConnection = &mut *conn; crate::metric::metric!(self.metric_callback, &stmt, { query.execute(conn).await.map(Into::into) }) @@ -347,20 +350,29 @@ impl ConnectionTrait for DatabaseTransaction { match &mut *self.conn.lock().await { #[cfg(feature = "sqlx-mysql")] - InnerConnection::MySql(conn) => sqlx::Executor::execute(conn, sql) - .await - .map(Into::into) - .map_err(sqlx_error_to_exec_err), + InnerConnection::MySql(conn) => { + let conn: &mut sqlx::MySqlConnection = &mut *conn; + sqlx::Executor::execute(conn, sql) + .await + .map(Into::into) + .map_err(sqlx_error_to_exec_err) + } #[cfg(feature = "sqlx-postgres")] - InnerConnection::Postgres(conn) => sqlx::Executor::execute(conn, sql) - .await - .map(Into::into) - .map_err(sqlx_error_to_exec_err), + InnerConnection::Postgres(conn) => { + let conn: &mut sqlx::PgConnection = &mut *conn; + sqlx::Executor::execute(conn, sql) + .await + .map(Into::into) + .map_err(sqlx_error_to_exec_err) + } #[cfg(feature = "sqlx-sqlite")] - InnerConnection::Sqlite(conn) => sqlx::Executor::execute(conn, sql) - .await - .map(Into::into) - .map_err(sqlx_error_to_exec_err), + InnerConnection::Sqlite(conn) => { + let conn: &mut sqlx::SqliteConnection = &mut *conn; + sqlx::Executor::execute(conn, sql) + .await + .map(Into::into) + .map_err(sqlx_error_to_exec_err) + } #[cfg(feature = "mock")] InnerConnection::Mock(conn) => { let db_backend = conn.get_database_backend(); @@ -381,6 +393,7 @@ impl ConnectionTrait for DatabaseTransaction { #[cfg(feature = "sqlx-mysql")] InnerConnection::MySql(conn) => { let query = crate::driver::sqlx_mysql::sqlx_query(&stmt); + let conn: &mut sqlx::MySqlConnection = &mut *conn; crate::metric::metric!(self.metric_callback, &stmt, { Self::map_err_ignore_not_found( query.fetch_one(conn).await.map(|row| Some(row.into())), @@ -390,6 +403,7 @@ impl ConnectionTrait for DatabaseTransaction { #[cfg(feature = "sqlx-postgres")] InnerConnection::Postgres(conn) => { let query = crate::driver::sqlx_postgres::sqlx_query(&stmt); + let conn: &mut sqlx::PgConnection = &mut *conn; crate::metric::metric!(self.metric_callback, &stmt, { Self::map_err_ignore_not_found( query.fetch_one(conn).await.map(|row| Some(row.into())), @@ -399,6 +413,7 @@ impl ConnectionTrait for DatabaseTransaction { #[cfg(feature = "sqlx-sqlite")] InnerConnection::Sqlite(conn) => { let query = crate::driver::sqlx_sqlite::sqlx_query(&stmt); + let conn: &mut sqlx::SqliteConnection = &mut *conn; crate::metric::metric!(self.metric_callback, &stmt, { Self::map_err_ignore_not_found( query.fetch_one(conn).await.map(|row| Some(row.into())), @@ -421,6 +436,7 @@ impl ConnectionTrait for DatabaseTransaction { #[cfg(feature = "sqlx-mysql")] InnerConnection::MySql(conn) => { let query = crate::driver::sqlx_mysql::sqlx_query(&stmt); + let conn: &mut sqlx::MySqlConnection = &mut *conn; crate::metric::metric!(self.metric_callback, &stmt, { query .fetch_all(conn) @@ -432,6 +448,7 @@ impl ConnectionTrait for DatabaseTransaction { #[cfg(feature = "sqlx-postgres")] InnerConnection::Postgres(conn) => { let query = crate::driver::sqlx_postgres::sqlx_query(&stmt); + let conn: &mut sqlx::PgConnection = &mut *conn; crate::metric::metric!(self.metric_callback, &stmt, { query .fetch_all(conn) @@ -443,6 +460,7 @@ impl ConnectionTrait for DatabaseTransaction { #[cfg(feature = "sqlx-sqlite")] InnerConnection::Sqlite(conn) => { let query = crate::driver::sqlx_sqlite::sqlx_query(&stmt); + let conn: &mut sqlx::SqliteConnection = &mut *conn; crate::metric::metric!(self.metric_callback, &stmt, { query .fetch_all(conn) diff --git a/src/driver/sqlx_mysql.rs b/src/driver/sqlx_mysql.rs index a777ecb89..51a1842a7 100644 --- a/src/driver/sqlx_mysql.rs +++ b/src/driver/sqlx_mysql.rs @@ -49,9 +49,9 @@ impl SqlxMySqlConnector { .map_err(sqlx_error_to_conn_err)?; use sqlx::ConnectOptions; if !options.sqlx_logging { - opt.disable_statement_logging(); + opt = opt.disable_statement_logging(); } else { - opt.log_statements(options.sqlx_logging_level); + opt = opt.log_statements(options.sqlx_logging_level); } match options.pool_options().connect_with(opt).await { Ok(pool) => Ok(DatabaseConnection::SqlxMySqlPoolConnection( @@ -82,9 +82,9 @@ impl SqlxMySqlPoolConnection { debug_print!("{}", stmt); let query = sqlx_query(&stmt); - let conn = &mut self.pool.acquire().await.map_err(conn_acquire_err)?; + let mut conn = self.pool.acquire().await.map_err(conn_acquire_err)?; crate::metric::metric!(self.metric_callback, &stmt, { - match query.execute(conn).await { + match query.execute(&mut *conn).await { Ok(res) => Ok(res.into()), Err(err) => Err(sqlx_error_to_exec_err(err)), } @@ -109,9 +109,9 @@ impl SqlxMySqlPoolConnection { debug_print!("{}", stmt); let query = sqlx_query(&stmt); - let conn = &mut self.pool.acquire().await.map_err(conn_acquire_err)?; + let mut conn = self.pool.acquire().await.map_err(conn_acquire_err)?; crate::metric::metric!(self.metric_callback, &stmt, { - match query.fetch_one(conn).await { + match query.fetch_one(&mut *conn).await { Ok(row) => Ok(Some(row.into())), Err(err) => match err { sqlx::Error::RowNotFound => Ok(None), @@ -127,9 +127,9 @@ impl SqlxMySqlPoolConnection { debug_print!("{}", stmt); let query = sqlx_query(&stmt); - let conn = &mut self.pool.acquire().await.map_err(conn_acquire_err)?; + let mut conn = self.pool.acquire().await.map_err(conn_acquire_err)?; crate::metric::metric!(self.metric_callback, &stmt, { - match query.fetch_all(conn).await { + match query.fetch_all(&mut *conn).await { Ok(rows) => Ok(rows.into_iter().map(|r| r.into()).collect()), Err(err) => Err(sqlx_error_to_query_err(err)), } diff --git a/src/driver/sqlx_postgres.rs b/src/driver/sqlx_postgres.rs index 35f65a619..1214f6c29 100644 --- a/src/driver/sqlx_postgres.rs +++ b/src/driver/sqlx_postgres.rs @@ -49,9 +49,9 @@ impl SqlxPostgresConnector { .map_err(sqlx_error_to_conn_err)?; use sqlx::ConnectOptions; if !options.sqlx_logging { - opt.disable_statement_logging(); + opt = opt.disable_statement_logging(); } else { - opt.log_statements(options.sqlx_logging_level); + opt = opt.log_statements(options.sqlx_logging_level); } let set_search_path_sql = options .schema_search_path @@ -97,9 +97,9 @@ impl SqlxPostgresPoolConnection { debug_print!("{}", stmt); let query = sqlx_query(&stmt); - let conn = &mut self.pool.acquire().await.map_err(conn_acquire_err)?; + let mut conn = self.pool.acquire().await.map_err(conn_acquire_err)?; crate::metric::metric!(self.metric_callback, &stmt, { - match query.execute(conn).await { + match query.execute(&mut *conn).await { Ok(res) => Ok(res.into()), Err(err) => Err(sqlx_error_to_exec_err(err)), } @@ -124,9 +124,9 @@ impl SqlxPostgresPoolConnection { debug_print!("{}", stmt); let query = sqlx_query(&stmt); - let conn = &mut self.pool.acquire().await.map_err(conn_acquire_err)?; + let mut conn = self.pool.acquire().await.map_err(conn_acquire_err)?; crate::metric::metric!(self.metric_callback, &stmt, { - match query.fetch_one(conn).await { + match query.fetch_one(&mut *conn).await { Ok(row) => Ok(Some(row.into())), Err(err) => match err { sqlx::Error::RowNotFound => Ok(None), @@ -142,9 +142,9 @@ impl SqlxPostgresPoolConnection { debug_print!("{}", stmt); let query = sqlx_query(&stmt); - let conn = &mut self.pool.acquire().await.map_err(conn_acquire_err)?; + let mut conn = self.pool.acquire().await.map_err(conn_acquire_err)?; crate::metric::metric!(self.metric_callback, &stmt, { - match query.fetch_all(conn).await { + match query.fetch_all(&mut *conn).await { Ok(rows) => Ok(rows.into_iter().map(|r| r.into()).collect()), Err(err) => Err(sqlx_error_to_query_err(err)), } diff --git a/src/driver/sqlx_sqlite.rs b/src/driver/sqlx_sqlite.rs index f8d351a9b..8a9924cf5 100644 --- a/src/driver/sqlx_sqlite.rs +++ b/src/driver/sqlx_sqlite.rs @@ -53,9 +53,9 @@ impl SqlxSqliteConnector { } use sqlx::ConnectOptions; if !options.sqlx_logging { - opt.disable_statement_logging(); + opt = opt.disable_statement_logging(); } else { - opt.log_statements(options.sqlx_logging_level); + opt = opt.log_statements(options.sqlx_logging_level); } if options.get_max_connections().is_none() { options.max_connections(1); @@ -89,9 +89,9 @@ impl SqlxSqlitePoolConnection { debug_print!("{}", stmt); let query = sqlx_query(&stmt); - let conn = &mut self.pool.acquire().await.map_err(conn_acquire_err)?; + let mut conn = self.pool.acquire().await.map_err(conn_acquire_err)?; crate::metric::metric!(self.metric_callback, &stmt, { - match query.execute(conn).await { + match query.execute(&mut *conn).await { Ok(res) => Ok(res.into()), Err(err) => Err(sqlx_error_to_exec_err(err)), } @@ -116,9 +116,9 @@ impl SqlxSqlitePoolConnection { debug_print!("{}", stmt); let query = sqlx_query(&stmt); - let conn = &mut self.pool.acquire().await.map_err(conn_acquire_err)?; + let mut conn = self.pool.acquire().await.map_err(conn_acquire_err)?; crate::metric::metric!(self.metric_callback, &stmt, { - match query.fetch_one(conn).await { + match query.fetch_one(&mut *conn).await { Ok(row) => Ok(Some(row.into())), Err(err) => match err { sqlx::Error::RowNotFound => Ok(None), @@ -134,9 +134,9 @@ impl SqlxSqlitePoolConnection { debug_print!("{}", stmt); let query = sqlx_query(&stmt); - let conn = &mut self.pool.acquire().await.map_err(conn_acquire_err)?; + let mut conn = self.pool.acquire().await.map_err(conn_acquire_err)?; crate::metric::metric!(self.metric_callback, &stmt, { - match query.fetch_all(conn).await { + match query.fetch_all(&mut *conn).await { Ok(rows) => Ok(rows.into_iter().map(|r| r.into()).collect()), Err(err) => Err(sqlx_error_to_query_err(err)), }