Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PooledConn with mysql 25 error #352

Open
JonasFocke01 opened this issue Nov 8, 2024 · 0 comments
Open

PooledConn with mysql 25 error #352

JonasFocke01 opened this issue Nov 8, 2024 · 0 comments

Comments

@JonasFocke01
Copy link

Hello,
im seeing an error i cant explain or find fixes on the internet. Can you help me here?

Im using this packages in my Cargo.toml:

mysql = "25.0.1"
refinery = { version = "0.8.14", features = ["mysql"]}

The mysql initialization happens flawlessly:

let url = format!(
    "mysql://my_usr:my_pass@localhost:3306/{}",
    if cfg!(debug_assertions) {
        "my_db_dev"
    } else {
        "my_db"
    }
);
let Ok(pool) = Pool::new(url.as_str()) else {
    ...
    std::process::exit(1);
};
let Ok(mut db_connection) = pool.get_conn() else {
    ...
    std::process::exit(1);
};

But creating the migrations like this

refinery::embed_migrations!("./src/database_handler/migrations"); // compiles without errors
migrations::runner().run(&mut db_connection).unwrap(); // compile time error

Results in an error, that tells me, that the mysql::PooledConn is not implementing refinery::Migrate. Only mysql::conn::pool::PooledConn is implementing it. I poked around a bit but have not found a solution to my problem. Can you help me?

Full error message:

Full error message
error[E0277]: the trait bound `mysql::PooledConn: refinery::Migrate` is not satisfied
   --> src/database_handler/mod.rs:68:34
    |
68  |         migrations::runner().run(&mut db_connection).unwrap();
    |                              --- ^^^^^^^^^^^^^^^^^^ the trait `refinery::Migrate` is not implemented for `mysql::PooledConn`
    |                              |
    |                              required by a bound introduced by this call
    |
    = help: the following other types implement trait `refinery::Migrate`:
              mysql::conn::Conn
              mysql::conn::pool::PooledConn
              refinery::config::Config
note: required by a bound in `refinery::Runner::run`
   --> /home/jonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/refinery-core-0.8.14/src/runner.rs:364:12
    |
362 |     pub fn run<C>(&self, connection: &mut C) -> Result<Report, Error>
    |            --- required by a bound in this associated function
363 |     where
364 |         C: Migrate,
    |            ^^^^^^^ required by this bound in `Runner::run`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant