rust-db / refinery

Powerful SQL migration toolkit for Rust.
MIT License
1.35k stars 126 forks source link

Sqlx no longer supported because Migrate no longer implemented by Config #311

Closed kingsleyh closed 10 months ago

kingsleyh commented 10 months ago

I'm getting this error:

error[E0277]: the trait bound `Config: Migrate` is not satisfied
   --> private-credit-service/src/server.rs:161:40
    |
161 |     embedded::migrations::runner().run(&mut c);
    |                                    --- ^^^^^^ the trait `Migrate` is not implemented for `Config`
    |                                    |
    |                                    required by a bound introduced by this call
    |
note: required by a bound in `Runner::run`
   --> /Users/kings/.cargo/registry/src/index.crates.io-6f17d22bba15001f/refinery-core-0.8.12/src/runner.rs:385:12
    |
383 |     pub fn run<C>(&self, connection: &mut C) -> Result<Report, Error>
    |            --- required by a bound in this associated function
384 |     where
385 |         C: Migrate,
    |            ^^^^^^^ required by this bound in `Runner::run`

while trying to run this code:

   let mut c = Config::new(ConfigDbType::Postgres)
    .set_db_host("localhost")
    .set_db_port("54312")
    .set_db_name("db-local")
    .set_db_user("user")
    .set_db_pass("password");
    embedded::migrations::runner().run(&mut c);

The README suggests this is the way to use sqlx but seem to not work.

kingsleyh commented 10 months ago

omg - i misspelled features in the Cargo.toml hahahhahahaahahh

jxs commented 9 months ago

Hi! No worries, btw I am curious, doesn't sqlx offer a similar feature now?

5-pebbles commented 8 months ago

Hi! No worries, btw I am curious, doesn't sqlx offer a similar feature now?

It supports SQL migrations but not Rust ones, which I expect is a deal breaker for many people, including myself.

sqlx feature request for rust scripts