Archived
1
0
Fork 0

fix: applied migration names from query response

This commit is contained in:
Dmitriy Pleshevskiy 2021-02-19 22:37:27 +03:00
parent 7bd4f3d1f9
commit a4d8218307

View file

@ -138,7 +138,6 @@ impl DatabaseMigrationManager for MigrationManager {
let res = self let res = self
.conn .conn
.query("SELECT name FROM migrations ORDER BY id DESC", &[]) .query("SELECT name FROM migrations ORDER BY id DESC", &[])
.map(|row| row.first().unwrap().clone())
.or_else(|e| { .or_else(|e| {
if is_migrations_table_not_found(&e) { if is_migrations_table_not_found(&e) {
Ok(Vec::new()) Ok(Vec::new())
@ -147,7 +146,12 @@ impl DatabaseMigrationManager for MigrationManager {
} }
})?; })?;
Ok(res.into_iter().collect()) let applied_migration_names: Vec<String> = res
.into_iter()
.filter_map(|row| row.first().cloned())
.collect();
Ok(applied_migration_names)
} }
} }