address comments

This commit is contained in:
Robert Habermeier
2016-07-05 18:50:46 +02:00
parent d4c9c7cc23
commit fd62944efc
3 changed files with 14 additions and 12 deletions

View File

@@ -88,10 +88,13 @@ impl<T: SimpleMigration> Migration for T {
if batch.len() == config.batch_size {
try!(commit_batch(dest, &batch));
batch.clear();
}
}
try!(commit_batch(dest, &batch));
if batch.len() != 0 {
try!(commit_batch(dest, &batch));
}
Ok(())
}

View File

@@ -15,7 +15,8 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Tests for migrations.
//! A random temp directory is created. A database
//! A random temp directory is created. A database is created within it, and migrations
//! are performed in temp sub-directories.
use common::*;
use migration::{Config, SimpleMigration, Manager};
@@ -43,7 +44,7 @@ fn make_db(path: &Path, pairs: BTreeMap<Vec<u8>, Vec<u8>>) {
}
}
// helper for verifying a a migrated database.
// helper for verifying a migrated database.
fn verify_migration(path: &Path, pairs: BTreeMap<Vec<u8>, Vec<u8>>) {
let db = Database::open_default(path.to_str().unwrap()).unwrap();