Replies: 2 comments
-
To generate the client you need to run As for how to use it in a Tauri project, apps like Spacedrive and Twidge are good examples - though it shouldn't be much more work than following the setup instructions inside |
Beta Was this translation helpful? Give feedback.
-
I have had a problem following the docs as well, and it appeared that from some other docs (or maybe an older version of prisma-client-rust's docs), I had tokio = { version = "0.2.*" } removing the line and letting cargo figure out the best version solved it for me (meaning running So, my findings in general are as follows, if one wants to do the workspace layout:
[workspace]
members = [
"app",
"prisma",
]
[alias]
prisma = "run --bin prisma --"
[package]
name = "prisma"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.8", default-features = false, features = [ "sqlite" ] }
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.8", default-features = false, features = [ "sqlite" ] }
serde = "1.0.164"
fn main() {
prisma_client_rust_cli::run();
}
#[allow(warnings, unused)]
pub mod prisma;
[package]
name = "app"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.8", default-features = false, features = [ "sqlite" ] }
serde = "1.0.164"
tokio = { version = "1.29.*", features = ["full"] }
prisma = { path = "../prisma" }
use std::process::exit;
use prisma::prisma;
#[tokio::main]
async fn main() {
let client = prisma::new_client().await; // Result<PrismaClient, ::prisma_client_rust::NewClientError>
if client.is_err() {
print!("Client was not able to be created");
exit(1)
}
... In short, Also please note in my examples I am using sqlite. If you use something else, remove or adjust the "features" flag in the dependency line in |
Beta Was this translation helpful? Give feedback.
-
Hi,
I used to use Prisma in Node environment and usually setup Prisma using npx.
In your installation guideline, specifically the As A Workspace Crate, i got the file structure clear. What i'm not sure is what precisely the content of each file looks like, and also what to do after that. How to initialize the prisma schema?
Actually i do some trial and error to figure out the content of each file for structure you provide by reading through your explanation before the part As A Workspace Crate like init the schema like
cargo prisma init
but still got some error and i'm not sure if my init command is failed or there is something in my setup files that missed.For my case i want ot add prisma to my Tauri project.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions