fix(migrate): improve error message when parsing version from filename

supercedes #2906
This commit is contained in:
Austin Bonander 2024-03-04 17:09:43 -08:00
parent b4f6596b06
commit c32809af91

View file

@ -47,7 +47,10 @@ impl<'s> MigrationSource<'s> for &'s Path {
continue;
}
let version: i64 = parts[0].parse()?;
let version: i64 = parts[0].parse()
.map_err(|_e| {
format!("error parsing migration filename {file_name:?}; expected integer version prefix (e.g. `01_foo.sql`)")
})?;
let migration_type = MigrationType::from_filename(parts[1]);
// remove the `.sql` and replace `_` with ` `