Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit 7f7d34f

Browse files
committed
only treat schema urls as relative
1 parent ec2ac40 commit 7f7d34f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

cli/src/generator/client.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,23 +84,23 @@ pub fn generate(args: &GenerateArgs) -> TokenStream {
8484
let url = match self.url {
8585
Some(url) => url,
8686
None => {
87-
if let Some(url) = source.load_shadow_database_url()? {
87+
let url = if let Some(url) = source.load_shadow_database_url()? {
8888
url
8989
} else {
9090
source.load_url(|key| std::env::var(key).ok())?
91-
}
92-
}
93-
};
91+
};
9492

95-
let url = match url.starts_with("file:") {
96-
true => {
97-
let path = url.split(":").nth(1).unwrap();
93+
match url.starts_with("file:") {
94+
true => {
95+
let path = url.split(":").nth(1).unwrap();
9896

99-
if std::path::Path::new("./prisma/schema.prisma").exists() {
100-
format!("file:./prisma/{}", path)
101-
} else { url }
102-
},
103-
_ => url,
97+
if std::path::Path::new("./prisma/schema.prisma").exists() {
98+
format!("file:./prisma/{}", path)
99+
} else { url }
100+
},
101+
_ => url,
102+
}
103+
}
104104
};
105105

106106
let (db_name, executor) = #pcr::query_core::executor::load(&source, &[], &url).await?;

0 commit comments

Comments
 (0)