also move WAL file when moving database (#2583)

the WAL files come from sqlite WAL mode,
they have the same name as the database file with an extra `-wal` suffix.

according to https://sqlite.org/wal.html#the_wal_file ,
the WAL file is part of the persistent state of the database
and should be kept with the database if the database is copied or moved.
This commit is contained in:
bjoern
2021-08-02 20:43:46 +02:00
committed by GitHub
parent fdf3397437
commit 8729d2c4aa
2 changed files with 14 additions and 0 deletions

View File

@@ -559,6 +559,13 @@ impl Context {
blob_fname.push("-blobs");
dbfile.with_file_name(blob_fname)
}
pub fn derive_walfile(dbfile: &PathBuf) -> PathBuf {
let mut wal_fname = OsString::new();
wal_fname.push(dbfile.file_name().unwrap_or_default());
wal_fname.push("-wal");
dbfile.with_file_name(wal_fname)
}
}
impl InnerContext {