Don't delete old db after migration (#11662)

* Don't delete old db after migration

Fixes unwanted shuffling&deletion of the old database after a
migration that merely deletes data in one of the existing database
columns.

* Update util/migration-rocksdb/src/lib.rs

Co-Authored-By: Andronik Ordian <write@reusable.software>

Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
David
2020-04-29 16:58:14 +02:00
committed by GitHub
parent cb9800f04c
commit 748a8e384d
3 changed files with 30 additions and 9 deletions

View File

@@ -186,7 +186,10 @@ fn migrate_database(version: u32, db_path: &Path, mut migrations: MigrationManag
// completely in-place migration leads to the paths being equal.
// in that case, no need to shuffle directories.
if temp_path == db_path { return Ok(()) }
if temp_path == db_path {
trace!(target: "migrate", "In-place migration ran; leaving old database in place.");
return Ok(())
}
// create backup
fs::rename(&db_path, &backup_path)?;