address comments
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user