From 4fcb90655180d6f5779488d44942b76260cdeaf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=8B=D1=80=D1=86=D0=B5=D0=B2=20=D0=92=D0=B0=D0=B4?= =?UTF-8?q?=D0=B8=D0=BC=20=D0=98=D0=B3=D0=BE=D1=80=D0=B5=D0=B2=D0=B8=D1=87?= Date: Mon, 15 Jan 2024 19:28:56 +0300 Subject: [PATCH 1/3] Increase sqlx version --- crates/teloxide/Cargo.toml | 2 +- .../src/dispatching/dialogue/storage/sqlite_storage.rs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/teloxide/Cargo.toml b/crates/teloxide/Cargo.toml index 59c0fdb7..c6914358 100644 --- a/crates/teloxide/Cargo.toml +++ b/crates/teloxide/Cargo.toml @@ -99,7 +99,7 @@ serde_with_macros = "1.4" aquamarine = "0.1.11" either = "1.9.0" -sqlx = { version = "0.6", optional = true, default-features = false, features = [ +sqlx = { version = "0.7.3", optional = true, default-features = false, features = [ "macros", "sqlite", ] } diff --git a/crates/teloxide/src/dispatching/dialogue/storage/sqlite_storage.rs b/crates/teloxide/src/dispatching/dialogue/storage/sqlite_storage.rs index 00974be9..1268f0ab 100644 --- a/crates/teloxide/src/dispatching/dialogue/storage/sqlite_storage.rs +++ b/crates/teloxide/src/dispatching/dialogue/storage/sqlite_storage.rs @@ -40,7 +40,6 @@ impl SqliteStorage { serializer: S, ) -> Result, SqliteStorageError> { let pool = SqlitePool::connect(format!("sqlite:{path}?mode=rwc").as_str()).await?; - let mut conn = pool.acquire().await?; sqlx::query( " CREATE TABLE IF NOT EXISTS teloxide_dialogues ( @@ -49,7 +48,7 @@ CREATE TABLE IF NOT EXISTS teloxide_dialogues ( ); ", ) - .execute(&mut conn) + .execute(&pool) .await?; Ok(Arc::new(Self { pool, serializer })) From e2af6db694c0f46052f70abda0a6a6a9dfa473d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=8B=D1=80=D1=86=D0=B5=D0=B2=20=D0=92=D0=B0=D0=B4?= =?UTF-8?q?=D0=B8=D0=BC=20=D0=98=D0=B3=D0=BE=D1=80=D0=B5=D0=B2=D0=B8=D1=87?= Date: Mon, 15 Jan 2024 19:32:34 +0300 Subject: [PATCH 2/3] Rename feature sqlite-storage to sqlite-storage-nativetls --- crates/teloxide/Cargo.toml | 13 ++++++------- crates/teloxide/src/dispatching/dialogue.rs | 2 +- crates/teloxide/src/dispatching/dialogue/storage.rs | 4 ++-- crates/teloxide/src/features.md | 4 ++-- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/crates/teloxide/Cargo.toml b/crates/teloxide/Cargo.toml index c6914358..8286a3a7 100644 --- a/crates/teloxide/Cargo.toml +++ b/crates/teloxide/Cargo.toml @@ -23,8 +23,7 @@ default = ["native-tls", "ctrlc_handler", "teloxide-core/default", "auto-send"] webhooks = ["rand"] webhooks-axum = ["webhooks", "axum", "tower", "tower-http"] -# FIXME: rename `sqlite-storage` -> `sqlite-storage-nativetls` -sqlite-storage = ["sqlx", "sqlx/runtime-tokio-native-tls", "native-tls"] +sqlite-storage-nativetls = ["sqlx", "sqlx/runtime-tokio-native-tls", "native-tls"] sqlite-storage-rustls = ["sqlx", "sqlx/runtime-tokio-rustls", "rustls"] redis-storage = ["redis"] cbor-serializer = ["serde_cbor"] @@ -51,9 +50,9 @@ nightly = ["teloxide-core/nightly"] full = [ "webhooks", "webhooks-axum", - "sqlite-storage", + "sqlite-storage-nativetls", # "sqlite-storage-rustls" is explicitly ommited here, - # since it conflicts with "sqlite-storage" + # since it conflicts with "sqlite-storage-nativetls" "redis-storage", "cbor-serializer", "bincode-serializer", @@ -124,7 +123,7 @@ tokio-stream = "0.1" [package.metadata.docs.rs] -# NB: can't use `all-features = true`, because `sqlite-storage` conflicts with `sqlite-storage-rustls` +# NB: can't use `all-features = true`, because `sqlite-storage-nativetls` conflicts with `sqlite-storage-rustls` features = ["full", "nightly"] # FIXME: Add back "-Znormalize-docs" when https://github.com/rust-lang/rust/issues/93703 is fixed rustdoc-args = ["--cfg", "docsrs"] @@ -147,7 +146,7 @@ required-features = ["redis-storage", "cbor-serializer", "bincode-serializer"] [[test]] name = "sqlite" path = "tests/sqlite.rs" -required-features = ["sqlite-storage", "cbor-serializer", "bincode-serializer"] +required-features = ["sqlite-storage-nativetls", "cbor-serializer", "bincode-serializer"] [[example]] @@ -170,7 +169,7 @@ required-features = ["macros", "ctrlc_handler"] [[example]] name = "db_remember" required-features = [ - "sqlite-storage", + "sqlite-storage-nativetls", "redis-storage", "bincode-serializer", "macros", diff --git a/crates/teloxide/src/dispatching/dialogue.rs b/crates/teloxide/src/dispatching/dialogue.rs index b6135cc4..6f668e8f 100644 --- a/crates/teloxide/src/dispatching/dialogue.rs +++ b/crates/teloxide/src/dispatching/dialogue.rs @@ -96,7 +96,7 @@ #[cfg(feature = "redis-storage")] pub use self::{RedisStorage, RedisStorageError}; -#[cfg(feature = "sqlite-storage")] +#[cfg(feature = "sqlite-storage-nativetls")] pub use self::{SqliteStorage, SqliteStorageError}; pub use get_chat_id::GetChatId; diff --git a/crates/teloxide/src/dispatching/dialogue/storage.rs b/crates/teloxide/src/dispatching/dialogue/storage.rs index b78cd72e..73611c61 100644 --- a/crates/teloxide/src/dispatching/dialogue/storage.rs +++ b/crates/teloxide/src/dispatching/dialogue/storage.rs @@ -6,7 +6,7 @@ mod trace_storage; #[cfg(feature = "redis-storage")] mod redis_storage; -#[cfg(feature = "sqlite-storage")] +#[cfg(feature = "sqlite-storage-nativetls")] mod sqlite_storage; use futures::future::BoxFuture; @@ -22,7 +22,7 @@ pub use redis_storage::{RedisStorage, RedisStorageError}; pub use serializer::Serializer; use std::sync::Arc; -#[cfg(feature = "sqlite-storage")] +#[cfg(feature = "sqlite-storage-nativetls")] pub use sqlite_storage::{SqliteStorage, SqliteStorageError}; /// A storage with an erased error type. diff --git a/crates/teloxide/src/features.md b/crates/teloxide/src/features.md index a871ee1b..50a28701 100644 --- a/crates/teloxide/src/features.md +++ b/crates/teloxide/src/features.md @@ -16,8 +16,8 @@ | `native-tls` | Enables the [`native-tls`] TLS implementation (**enabled by default**). | | `rustls` | Enables the [`rustls`] TLS implementation. | | `redis-storage` | Enables the [Redis] storage support for dialogues. | -| `sqlite-storage` | Enables the [Sqlite] storage support for dialogues (depends on `native-tls`). | -| `sqlite-storage-rustls` | Enables the [Sqlite] storage support for dialogues (depends on `rustls`, conflicts with `sqlite-storage`). | +| `sqlite-storage-nativetls` | Enables the [Sqlite] storage support for dialogues (depends on `native-tls`). | +| `sqlite-storage-rustls` | Enables the [Sqlite] storage support for dialogues (depends on `rustls`, conflicts with `sqlite-storage-nativetls`). | | `cbor-serializer` | Enables the [CBOR] serializer for dialogues. | | `bincode-serializer` | Enables the [Bincode] serializer for dialogues. | From 0693113b8203a514e6bd2426be0ebcd4e7e0b23c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=8B=D1=80=D1=86=D0=B5=D0=B2=20=D0=92=D0=B0=D0=B4?= =?UTF-8?q?=D0=B8=D0=BC=20=D0=98=D0=B3=D0=BE=D1=80=D0=B5=D0=B2=D0=B8=D1=87?= Date: Mon, 15 Jan 2024 19:48:52 +0300 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9d7c647..6c371eca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - MSRV (Minimal Supported Rust Version) was bumped from `1.64.0` to `1.68.0` ([PR 950][https://github.com/teloxide/teloxide/pull/950]) +- Sqlx version was bumped from `0.6` to `0.7.3`([PR 995](https://github.com/teloxide/teloxide/pull/995)) +- Feature `sqlite-storage` was renamed to `sqlite-storage-nativetls`([PR 995](https://github.com/teloxide/teloxide/pull/995)) ### Removed