From a4d8218307a66bfd7b13641da1b784c76b620e6a Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 19 Feb 2021 22:37:27 +0300 Subject: [PATCH] fix: applied migration names from query response --- migra-cli/src/migration.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/migra-cli/src/migration.rs b/migra-cli/src/migration.rs index 559b5d1..3ec7556 100644 --- a/migra-cli/src/migration.rs +++ b/migra-cli/src/migration.rs @@ -138,7 +138,6 @@ impl DatabaseMigrationManager for MigrationManager { let res = self .conn .query("SELECT name FROM migrations ORDER BY id DESC", &[]) - .map(|row| row.first().unwrap().clone()) .or_else(|e| { if is_migrations_table_not_found(&e) { Ok(Vec::new()) @@ -147,7 +146,12 @@ impl DatabaseMigrationManager for MigrationManager { } })?; - Ok(res.into_iter().collect()) + let applied_migration_names: Vec = res + .into_iter() + .filter_map(|row| row.first().cloned()) + .collect(); + + Ok(applied_migration_names) } }