SeaQL / sea-orm

🐚 An async & dynamic ORM for Rust
https://www.sea-ql.org/SeaORM/
Apache License 2.0
6.57k stars 461 forks source link

Set runtime features for sqlx. #2171

Closed bamidev closed 3 months ago

bamidev commented 3 months ago

When you add sea-orm simply like this: sea-orm = { version = "0.12.15", features = ["runtime-tokio", "sqlx-sqlite"] } It will complain about no runtime being selected:

thread 'main' panicked at /home/bamilab/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-core-0.7.4/src/pool/inner.rs:52:24:
either the `runtime-async-std` or `runtime-tokio` feature must be enabled

Even though I use the "runtime-tokio" feature. It seems like it isn't being passed down to the sqlx crate.

For the moment I use the workaround of adding this to my Cargo.toml: sqlx = { features = ["runtime-tokio"] } But it is just a workaround.

tyt2y3 commented 3 months ago

You're right. The original design is that you have to specify a runtime+tls feature flag , e.g. runtime-tokio-native-tls. The runtime-tokio is transitive, and is simply used to signify that tokio has been enabled in sea-orm.