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

Missing downward feature `runtime-tokio`. #2174

Closed xuxiaocheng0201 closed 3 months ago

xuxiaocheng0201 commented 3 months ago

Description

Enabled runtime-tokio in sea-orm but panics

either the `runtime-async-std` or `runtime-tokio` feature must be enabled

in sqlx-core.

Steps to Reproduce

  1. Add sea-orm = { version = "1.0.0-rc.3", features = ["sqlx-sqlite", "runtime-tokio"] } to Cargo.toml
  2. In main.rs:
    
    use sea_orm::Database;

[tokio::main]

async fn main() -> anyhow::Result<()> { let connection = Database::connect("sqlite://1.db?mode=rwc").await?; connection.ping().await?; Ok(()) }

3. Compile and run.

### Expected Behavior

Normally run.

### Actual Behavior

Panic:
```text
thread 'main' panicked at D:\AppData\Languages\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
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Reproduces How Often

Always.

Workarounds

Missing downward feature.

Reproducible Example

Codes above.

Versions

I tested 1.0.0-rc.3 and 0.12.15, both had this problem.

billy1624 commented 3 months ago

Hey @xuxiaocheng0201, runtime-tokio is just a placeholder feature. It did nothing behind the scene. Please enable one of

https://github.com/SeaQL/sea-orm/blob/0ff000b8f845dc469e98000410443cc008f60d8c/Cargo.toml#L116-L126

xuxiaocheng0201 commented 3 months ago

Hey @xuxiaocheng0201, runtime-tokio is just a placeholder feature. It did nothing behind the scene. Please enable one of

  • runtime-tokio-native-tls
  • runtime-tokio-rustls

Thanks @billy1624 .

But I only use the sqlite backend, which needn't tls.

Enable runtime-tokio-native-tls or runtime-tokio-rustls resulted in additional unnecessary dependencies.

billy1624 commented 3 months ago

I see what you mean now. I just drafted a PR, would you like to try it? https://github.com/SeaQL/sea-orm/pull/2175

tyt2y3 commented 3 months ago

Fixed in #2171