Odonno / surrealdb-migrations

An awesome SurrealDB migration tool, with a user-friendly CLI and a versatile Rust library that enables seamless integration into any project.
https://crates.io/crates/surrealdb-migrations
MIT License
210 stars 16 forks source link

cargo install error expected `Result<(), Error>`, found `Result<Jwt, Error>` #50

Closed marko-lazic closed 11 months ago

marko-lazic commented 1 year ago

Describe the bug To Reproduce cargo install surrealdb-migrations returns the following error

error[E0308]: mismatched types --> /Users/markolazic/.cargo/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-migrations-0.9.12/src/surrealdb.rs:66:5 66 / client 67 .signin(Root { 68 username: &username, 69 password: &password, 70 }) 71 .await __^ expected Result<(), Error>, found Result<Jwt, Error>

= note: expected enum Result<(), _> found enum Result<Jwt, _>

For more information about this error, try rustc --explain E0308. error: could not compile surrealdb-migrations (lib) due to previous error warning: build failed, waiting for other jobs to finish... error: failed to compile surrealdb-migrations v0.9.12, intermediate artifacts can be found at /var/folders/qq/wdsqkg0n1kd825nr3npkckyh0000gn/T/cargo-installvcFG0T. To reuse those artifacts with a future compilation, set the environment variable CARGO_TARGET_DIR to that path.

It seem to be compiling surrealdb v1.0.0-beta.11

johansmitsnl commented 1 year ago

Where you able to solve it?

marko-lazic commented 1 year ago

Unfortunately not. It looks like it's using surrealdb main branch for something. I managed to do cargo run on source code and it works fine.

johansmitsnl commented 1 year ago

I just tried to change the Ok value of the error. But there are more changes needed:

note: associated function defined here
   --> /home/johan/.cargo/git/checkouts/surrealdb-migrations-634b65362507a38b/6e0162e/src/lib.rs:92:12
    |
92  |     pub fn new(db: &'a Surreal<C>) -> Self {
    |            ^^^

error[E0308]: mismatched types
   --> src/main.rs:51:32
    |
51  |     match MigrationRunner::new(&app_state.surrealdb)
    |           -------------------- ^^^^^^^^^^^^^^^^^^^^ expected `&Surreal<_>`, found `&Surreal<Client>`
    |           |
    |           arguments to this function are incorrect
    |
    = note: `Surreal<Client>` and `Surreal<_>` have similar names, but are actually distinct types
gibbz00 commented 1 year ago

Unfortunately not. It looks like it's using surrealdb main branch for something. I managed to do cargo run on source code and it works fine.

Well then you were lucky ;) Running cargo update on this repo will update surrealdb to an incompatible git ref. I'll try to send in a PR asap.

johansmitsnl commented 1 year ago

I created a PR #53 that uses the 1.0.0 release.

alveshelio commented 11 months ago

Hi,

I had surrealdb-migrations installed and tried to update with cargo install surrealdb-migrations --force but I'm still getting this error.

Even after uninstalling surrealdb-migration (cargo uninstall surrealdb-migration) and deleting surrealdb-migrations-0.9.12 inside .cargo/registry/src/index.crates.io-{id} I'm still getting this error.

Has anyone been able to solve this problem?

Odonno commented 11 months ago

With the release of 1.0.0, this issue should no longer occurs.

You can download the latest release of surrealdb-migrations:

cargo install surrealdb-migrations@1.0.0-preview.1