SeaQL / sea-orm

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

issue with Migrator::up, the trait bound `&sea_orm::DatabaseConnection: IntoSchemaManagerConnection<'_>` is not satisfied #2341

Open wildonion opened 2 weeks ago

wildonion commented 2 weeks ago

Hello guys, just updated to sea_orm version 1 I get the following error while I'm trying to apply migrations at startup the code is: I'm using the code inside the doc

let connect_options = sea_orm::ConnectOptions::new("postgres://root:root@localhost/database")
    .set_schema_search_path("my_schema") // Override the default schema
    .to_owned();

let db = sea_orm::Database::connect(connect_options).await.unwrap();
migration::Migrator::up(&db, None).await.unwrap();

the error is:

the trait bound `&sea_orm::DatabaseConnection: IntoSchemaManagerConnection<'_>` is not satisfied
the following other types implement trait `IntoSchemaManagerConnection<'c>`:
  &'c migration::sea_orm::DatabaseConnection
  &'c migration::sea_orm::DatabaseTransaction
  SchemaManagerConnection<'c>
required by a bound introduced by this call
migrator.rs(230, 12): required by a bound in `migration::MigratorTrait::up`

I've also tried to pass the db to up method with no pointer but still get the same error I would appreciate a lot if you could help me to fix this.

sontixyou commented 1 week ago

I got the same error. https://github.com/SeaQL/sea-orm/discussions/2311

wildonion commented 1 week ago

it seems that we should downgrade version below than 1 until they implement IntoSchemaManagerConnection trait for the for the database connection pointer. thanks.

I got the same error. #2311