Brendonovich / prisma-client-rust

Type-safe database access for Rust
https://prisma.brendonovich.dev
Apache License 2.0
1.76k stars 104 forks source link

Prisma cli build failed #256

Closed Alivers closed 1 year ago

Alivers commented 1 year ago

My Cargo.toml config:

prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.4" }

Prisma cli build failed with the error:

  Compiling quaint v0.2.0-alpha.13 (https://github.com/prisma/quaint?rev=fb4fe90682b4fecb485fd0d6975dd15a3bc9616b#fb4fe906)
error[E0599]: no method named `with_pkcs12_path` found for struct `SslOpts` in the current scope
   --> /Users/aliver/.cargo/git/checkouts/quaint-9f01e008b9a89c14/fb4fe90/src/connector/mysql.rs:187:41
    |
187 |                     ssl_opts = ssl_opts.with_pkcs12_path(Some(Path::new(&*v).to_path_buf()));
    |                                         ^^^^^^^^^^^^^^^^ method not found in `SslOpts`

error[E0599]: no method named `with_password` found for struct `SslOpts` in the current scope
   --> /Users/aliver/.cargo/git/checkouts/quaint-9f01e008b9a89c14/fb4fe90/src/connector/mysql.rs:191:41
    |
191 |                     ssl_opts = ssl_opts.with_password(Some(v.to_string()));
    |                                         ^^^^^^^^^^^^^ method not found in `SslOpts`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `quaint` due to 2 previous errors
Alivers commented 1 year ago

quaint update mysql_async dependency 19h ago. How can we upgrade to fix this break changes? https://github.com/prisma/quaint

Brendonovich commented 1 year ago

I'm pretty sure this couldn't have been solved with [patch] since it's to do with nested git dependencies. I've forked quaint and locked it to a specific commit of mysql_async. Try using rev = "6fbef57fcd08fd1daeb70b49b14f5144b15898aa" of PCR. I'm gonna try get Prisma's engines team to prefer using specific commits rather than branch references going forward. It'd be way more reliable.

Alivers commented 1 year ago

After I change rev to 6fbef57fcd08fd1daeb70b49b14f5144b15898aa, the generated code did not work with my project. The error is:

error[E0425]: cannot find function `is_empty` in module `snapshot_meta::error_versions`
   --> src/core/prisma_processor_metadata.rs:185:48
    |
185 |                 snapshot_meta::error_versions::is_empty(false),
    |                                                ^^^^^^^^ not found in `snapshot_meta::error_versions`

error[E0425]: cannot find function `is_empty` in module `snapshot_meta::interested_versions`
   --> src/core/prisma_processor_metadata.rs:208:53
    |
208 |                 snapshot_meta::interested_versions::is_empty(false),
    |                                                     ^^^^^^^^ not found in `snapshot_meta::interested_versions`

And also, my schema.prisma definition has no change, above two fields are defined in Bigint[]:

    interested_versions BigInt[]
    error_versions      BigInt[]
Brendonovich commented 1 year ago

Hmm, using mysql I'm not even allowed to use BigInt[] as a field type - postgresql works though, and that doesn't have the is_empty filter. That's on both 0.6.4 and 6fbef57fcd08fd1daeb70b49b14f5144b15898aa.

Alivers commented 1 year ago

Sorry, I missed the db. I'm using mongodb, a few days ago I am using 0.6.3, it works correctly. 0.6.3 generates the code as below, but when I move to rev 6fbef57fcd08fd1daeb70b49b14f5144b15898aa or 0.6.4, I clouldn't get the same generated code.

image
Brendonovich commented 1 year ago

Ohh you're not using default-features = false, features = ["mongodb"], gotcha. Looks like a regression to do with scalar lists. Will be fixed soon.

Alivers commented 1 year ago

Thanks for your insight and reminder! I really should use default-features = false, features = ["mongodb"] to avoid unnecessary build.

Brendonovich commented 1 year ago

@Alivers check new issue for fix: https://github.com/Brendonovich/prisma-client-rust/issues/257

MachariaK commented 1 year ago

The proposed fix is not working for me.

Cargo.toml:

prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust", rev = "1f6474396363bab8c4cdd70c342055779b36909d" } prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", rev = "1f6474396363bab8c4cdd70c342055779b36909d" } Error:

error[E0433]: failed to resolve: could not findClientIdentityinmysql_async --> C:\Users\Tim\.cargo\git\checkouts\quaint-453f07acedd929b5\b12fef8\src\connector\mysql.rs:282:45 | 282 | let identity = mysql_async::ClientIdentity::new(path).with_password(pw); | ^^^^^^^^^^^^^^ could not findClientIdentityinmysql_async`

error[E0433]: failed to resolve: could not find ClientIdentity in mysql_async --> C:\Users\Tim.cargo\git\checkouts\quaint-453f07acedd929b5\b12fef8\src\connector\mysql.rs:286:45 | 286 | let identity = mysql_async::ClientIdentity::new(path); | ^^^^^^^^^^^^^^ could not find ClientIdentity in mysql_async

error[E0599]: no method named with_client_identity found for struct SslOpts in the current scope --> C:\Users\Tim.cargo\git\checkouts\quaint-453f07acedd929b5\b12fef8\src\connector\mysql.rs:283:26 | 283 | ssl_opts.with_client_identity(Some(identity)) | ^^^^^^^^^^^^^^^^^^^^ method not found in SslOpts

error[E0599]: no method named with_client_identity found for struct SslOpts in the current scope --> C:\Users\Tim.cargo\git\checkouts\quaint-453f07acedd929b5\b12fef8\src\connector\mysql.rs:287:26 | 287 | ssl_opts.with_client_identity(Some(identity)) | ^^^^^^^^^^^^^^^^^^^^ method not found in SslOpts

Some errors have detailed explanations: E0433, E0599.
For more information about an error, try rustc --explain E0433. error: could not compile quaint due to 4 previous errors `

Brendonovich commented 1 year ago

@MachariaK Does using version 0.6.5 fix this? I haven't seen those errors before.

MachariaK commented 1 year ago

@MachariaK Does using version 0.6.5 fix this? I haven't seen those errors before.

Doesn't fix.

I am getting the following errors:

error[E0433]: failed to resolve: could not find ClientIdentity in mysql_async --> C:\Users\Tim.cargo\git\checkouts\quaint-453f07acedd929b5\b12fef8\src\connector\mysql.rs:282:45 | 282 | let identity = mysql_async::ClientIdentity::new(path).with_password(pw); | ^^^^^^^^^^^^^^ could not find ClientIdentity in mysql_async

error[E0433]: failed to resolve: could not find ClientIdentity in mysql_async --> C:\Users\Tim.cargo\git\checkouts\quaint-453f07acedd929b5\b12fef8\src\connector\mysql.rs:286:45 | 286 | let identity = mysql_async::ClientIdentity::new(path); | ^^^^^^^^^^^^^^ could not find ClientIdentity in mysql_async

error[E0599]: no method named with_client_identity found for struct SslOpts in the current scope --> C:\Users\Tim.cargo\git\checkouts\quaint-453f07acedd929b5\b12fef8\src\connector\mysql.rs:283:26 | 283 | ssl_opts.with_client_identity(Some(identity)) | ^^^^^^^^^^^^^^^^^^^^ method not found in SslOpts

error[E0599]: no method named with_client_identity found for struct SslOpts in the current scope --> C:\Users\Tim.cargo\git\checkouts\quaint-453f07acedd929b5\b12fef8\src\connector\mysql.rs:287:26 | 287 | ssl_opts.with_client_identity(Some(identity)) | ^^^^^^^^^^^^^^^^^^^^ method not found in SslOpts

Some errors have detailed explanations: E0433, E0599.
For more information about an error, try rustc --explain E0433. error: could not compile quaint due to 4 previous errors

Brendonovich commented 1 year ago

@MachariaK Does cargo update -p prisma-client-rust fix things?

MachariaK commented 1 year ago

@MachariaK Does cargo update -p prisma-client-rust fix things?

Running perfectly now.