From 95860f2bb35f90d490caedbdad81cfec00888c46 Mon Sep 17 00:00:00 2001 From: David Overton Date: Tue, 23 Apr 2024 13:25:02 +1000 Subject: [PATCH 1/2] Don't overwrite schema files that haven't changed --- crates/configuration/src/directory.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/configuration/src/directory.rs b/crates/configuration/src/directory.rs index aa1b9871..1e659561 100644 --- a/crates/configuration/src/directory.rs +++ b/crates/configuration/src/directory.rs @@ -164,7 +164,14 @@ where { let path = default_file_path(configuration_dir, basename); let bytes = serde_json::to_vec_pretty(value)?; - fs::write(path.clone(), bytes) + + // Don't write the file if it hasn't changed. + if let Ok(existing_bytes) = fs::read(&path).await { + if bytes == existing_bytes { + return Ok(()) + } + } + fs::write(&path, bytes) .await .with_context(|| format!("error writing {:?}", path)) } From 3d00279585d0a2a5e4cc13ddc73805997b9909cf Mon Sep 17 00:00:00 2001 From: David Overton Date: Tue, 23 Apr 2024 13:30:19 +1000 Subject: [PATCH 2/2] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 216443be..fd0c4faa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ This changelog documents the changes between release versions. ## [Unreleased] - Fix incorrect order of results for query requests with more than 10 variable sets (#37) +- In the CLI update command, don't overwrite schema files that haven't changed ([#49](https://github.com/hasura/ndc-mongodb/pull/49/files)) ## [0.0.4] - 2024-04-12 - Queries that attempt to compare a column to a column in the query root table, or a related table, will now fail instead of giving the incorrect result ([#22](https://github.com/hasura/ndc-mongodb/pull/22))