nivek-ph opened a new issue, #112:
URL: https://github.com/apache/casbin-sqlx-adapter/issues/112
## Problem
PR #108 updates the `sqlx` requirement from 0.8 to 0.9, but SQLx 0.9 removed
the combined runtime/TLS feature names currently used by this crate.
Changing only:
```toml
sqlx = { version = "0.9", default-features = false, features = ["macros"] }
```
fails dependency resolution with errors such as:
```text
package `sqlx-adapter` depends on `sqlx` with feature
`runtime-async-std-native-tls` but `sqlx` does not have that feature
```
## Proposed changes
Keep the existing public feature names for downstream compatibility, but map
them to SQLx 0.9 features:
```toml
runtime-async-std-native-tls = [
"casbin/runtime-async-std",
"sqlx/runtime-async-std",
"sqlx/tls-native-tls",
]
runtime-async-std-rustls = [
"casbin/runtime-async-std",
"sqlx/runtime-async-std",
"sqlx/tls-rustls",
]
runtime-tokio = [
"casbin/runtime-tokio",
"sqlx/runtime-tokio",
]
runtime-tokio-native-tls = [
"casbin/runtime-tokio",
"sqlx/runtime-tokio",
"sqlx/tls-native-tls",
]
runtime-tokio-rustls = [
"casbin/runtime-tokio",
"sqlx/runtime-tokio",
"sqlx/tls-rustls",
]
```
The upgrade is also an opportunity to remove unused direct dependencies:
- The optional `tokio` and `async-std` dependencies are not enabled by the
crate's runtime features, and production code does not use them directly. The
dev-dependencies are sufficient for the test macros.
- `dotenvy` is only used by `SqlxAdapter::new()` to call `dotenv().ok()`.
The adapter already receives a complete database URL, so loading the caller's
`.env` is an unnecessary hidden side effect.
The plain `runtime-tokio` feature should also attach the existing Tokio
tests. Currently, only the TLS variants receive `#[tokio::test]`.
## Acceptance criteria
- PostgreSQL builds with Tokio and async-std.
- Native TLS and rustls variants compile.
- `runtime-tokio` without a TLS backend runs the existing tests.
- `SqlxAdapter::new_with_pool(pool.clone())` accepts a SQLx 0.9 pool.
- Policies saved through a shared pool can be loaded by another
adapter/Enforcer using the same pool.
- Existing policy add/remove tests continue to pass.
- SQLx 0.9 offline metadata is generated for PostgreSQL, MySQL, and SQLite.
- A downstream application using SQLx 0.9 resolves one SQLx version rather
than both 0.8 and 0.9.
Related: #108, #109.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]