SeaQL / sea-orm

šŸš An async & dynamic ORM for Rust
https://www.sea-ql.org/SeaORM/
Apache License 2.0
7.03k stars 493 forks source link

sea-orm-migration - Compile error using most recent version of rc2 #2173

Closed isaacdonaldson closed 6 months ago

isaacdonaldson commented 6 months ago

Description

Compiling with most recent version of sea-orm-migration 1.0.0-rc.2 causes a compiler error.

Steps to Reproduce

(not the best reproduction, apologies)

  1. Create a new cargo project and add this to the Cargo.toml dependencies:
    
    [dependencies]
    async-std = { version = "1", features = ["attributes", "tokio1"] }

[dependencies.sea-orm-migration] version = "1.0.0-rc.2" features = ["runtime-tokio-rustls"]

2. Then add this to the `src/main.rs` file
```rust
use sea_orm_migration::prelude::*;

#[async_std::main]
fn main() {
    let manager = SchemaManager::new("");
}
  1. run cargo run and see a compiler error complaining about argument arity.

Expected Behavior

The program should fail to compile because the IntoSchemaManagerConnection trait is not implemented for &str, not because of argument arity.

I it's a bad reproduction and I know it, sorry.

Actual Behavior

It produces the error:

error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-migration-1.0.0-rc.2/src/migrator.rs:444:29
    |
444 |         DbBackend::MySql => MySql::query_tables(),
    |                             ^^^^^^^^^^^^^^^^^^^-- an argument of type `&sea_schema::mysql::MySql` is missing
    |
note: method defined here
   --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-schema-0.15.0-rc.4/src/probe.rs:6:8
    |
6   |     fn query_tables(&self) -> SelectStatement;
    |        ^^^^^^^^^^^^
help: provide the argument
    |
444 |         DbBackend::MySql => MySql::query_tables(/* &sea_schema::mysql::MySql */),
    |                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-migration-1.0.0-rc.2/src/migrator.rs:445:32
    |
445 |         DbBackend::Postgres => Postgres::query_tables(),
    |                                ^^^^^^^^^^^^^^^^^^^^^^-- an argument of type `&sea_schema::postgres::Postgres` is missing
    |
note: method defined here
   --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-schema-0.15.0-rc.4/src/probe.rs:6:8
    |
6   |     fn query_tables(&self) -> SelectStatement;
    |        ^^^^^^^^^^^^
help: provide the argument
    |
445 |         DbBackend::Postgres => Postgres::query_tables(/* &sea_schema::postgres::Postgres */),
    |                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-migration-1.0.0-rc.2/src/migrator.rs:446:30
    |
446 |         DbBackend::Sqlite => Sqlite::query_tables(),
    |                              ^^^^^^^^^^^^^^^^^^^^-- an argument of type `&sea_schema::sqlite::Sqlite` is missing
    |
note: method defined here
   --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-schema-0.15.0-rc.4/src/probe.rs:6:8
    |
6   |     fn query_tables(&self) -> SelectStatement;
    |        ^^^^^^^^^^^^
help: provide the argument
    |
446 |         DbBackend::Sqlite => Sqlite::query_tables(/* &sea_schema::sqlite::Sqlite */),
    |                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For more information about this error, try `rustc --explain E0061`.
error: could not compile `sea-orm-migration` (lib) due to 3 previous errors

Workarounds

Changing the Cargo.lock entry for sea-schema from

[[package]]
name = "sea-schema"
version = "0.15.0-rc.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20ed3975863149bdc9dcc19007d55c16255e9805ab85c1e9792d4bb5d2a694d6"
dependencies = [
 "futures",
 "sea-query",
 "sea-schema-derive",
]

to

[[package]]
name = "sea-schema"
version = "0.15.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a72566ad1d27181ea2aff75394600491c12a32ee87cc4d50381bc577ce63a33"
dependencies = [
 "futures",
 "sea-query",
 "sea-schema-derive",
]

Reproducible Example

Example above

Versions

sea-orm-migration -> 1.0.0-rc.2 sea-schema -> 0.15.0-rc4

isaacdonaldson commented 6 months ago

To add to this, I believe this is the commit when the version of the sea-schema dependency was bumped: https://github.com/SeaQL/sea-orm/commit/5d78e56f8c511544315eb76d894c2afb5a5dd16a

And it might be because in this sea-schema commit the number of arguments passed to the query_tables function changed: https://github.com/SeaQL/sea-schema/commit/9e148660774dc2a71a74154b80166312290b8d6a

DenuxPlays commented 6 months ago

Facing the same issue... Hopefully there will be a fix soon

DenuxPlays commented 6 months ago

Even v1.0.0-rc.1 cannot be compiled anymore

Non-rc versions works fine

isaacdonaldson commented 6 months ago

@DenuxPlays, if this is a showstopper for you then you can use the workaround I mentioned above and it should work fine for the time being (replace the entry for sea-scheme in the Cargo.lock)

DenuxPlays commented 6 months ago

@DenuxPlays, if this is a showstopper for you then you can use the workaround I mentioned above and it should work fine for the time being (replace the entry for sea-scheme in the Cargo.lock)

Yeah I just downgraded to the 0.12.15 or so I am not a huge fan of editing generated files as the doesn't end well

DenuxPlays commented 6 months ago

But this issue has been open for 19h and still no reaction this is kinda sad

isaacdonaldson commented 6 months ago

But this issue has been open for 19h and still no reaction this is kinda sad

0.12.15 is the stable release and 1.0.0-rc2 is the release candidate, so by using it you might encounter issues that you wouldn't find on the stable branch (like this one). Granted, not being able to compile is quite a big problem, but 19h is not a long time to be away from a computer

billy1624 commented 6 months ago

Hey everyone, thanks for raising this issue. The root cause is that we released 1.0.0-rc.2 before this https://github.com/SeaQL/sea-orm/commit/a321f0a566eade8bbfe9a105db1f6f974b662de2 commit.

I will be releasing 1.0.0-rc.3 in a few hours!

billy1624 commented 6 months ago

Released https://crates.io/crates/sea-orm/1.0.0-rc.3

yinho999 commented 6 months ago

Released https://crates.io/crates/sea-orm/1.0.0-rc.3

Thank you for letting us know about the update, also thanks for your assistance!

isaacdonaldson commented 6 months ago

Thanks for getting out a new update quickly, appreciate it šŸ˜„ !

tyt2y3 commented 6 months ago

Thanks everyone!