Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions crates/pgt_workspace/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,13 @@ pub fn create_config(
})?;

// we now check if postgrestools is installed inside `node_modules` and if so, we use the schema from there
if VERSION == "0.0.0" {
let schema_path = Path::new("./node_modules/@postgrestools/postgrestools/schema.json");
let options = OpenOptions::default().read(true);
if fs.open_with_options(schema_path, options).is_ok() {
configuration.schema = schema_path.to_str().map(String::from);
}
let node_schema_path = Path::new("./node_modules/@postgrestools/postgrestools/schema.json");
let options = OpenOptions::default().read(true);
if fs.open_with_options(node_schema_path, options).is_ok() {
configuration.schema = node_schema_path.to_str().map(String::from);
} else if VERSION == "0.0.0" {
Comment thread
juleswritescode marked this conversation as resolved.
Comment thread
psteinroe marked this conversation as resolved.
// VERSION is 0.0.0 if it has not been explicitly set (e.g local dev, as fallback)
configuration.schema = Some("https://pgtools.dev/schemas/latest/schema.json".to_string());
} else {
configuration.schema = Some(format!("https://pgtools.dev/schemas/{VERSION}/schema.json"));
}
Expand Down
Loading