diff --git a/sqld/src/lib.rs b/sqld/src/lib.rs index a62a4144..4b881abf 100644 --- a/sqld/src/lib.rs +++ b/sqld/src/lib.rs @@ -645,9 +645,9 @@ fn init_version_file(db_path: &Path) -> anyhow::Result<()> { return Ok(()); } - let version_path = db_path.join("dbs").join(".version"); + let version_path = db_path.join(".version"); if !version_path.exists() { - std::fs::create_dir_all(db_path.join("dbs"))?; + std::fs::create_dir_all(db_path)?; std::fs::write(version_path, env!("CARGO_PKG_VERSION"))?; } diff --git a/sqld/src/migration.rs b/sqld/src/migration.rs index 6fc6ab78..a8dd6239 100644 --- a/sqld/src/migration.rs +++ b/sqld/src/migration.rs @@ -22,7 +22,7 @@ pub fn maybe_migrate(db_path: &Path) -> anyhow::Result<()> { fn detect_version(db_path: &Path) -> anyhow::Result { let version_file_path = db_path.join(".version"); - if !version_file_path.exists() { + if !version_file_path.try_exists()? { return Ok(Version::Pre0_18); } @@ -41,7 +41,7 @@ fn migrate_step_from_pre_0_18(db_path: &Path) -> anyhow::Result<()> { std::fs::create_dir_all(&ns_dir)?; let maybe_link = |name| -> anyhow::Result<()> { - if db_path.join(name).exists() { + if db_path.join(name).try_exists()? { std::fs::hard_link(db_path.join(name), ns_dir.join(name))?; }