mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-03 07:45:30 +00:00
fix(migrate): improve error message when parsing version from filename
supercedes #2906
This commit is contained in:
parent
b4f6596b06
commit
c32809af91
@ -47,7 +47,10 @@ impl<'s> MigrationSource<'s> for &'s Path {
|
|||||||
continue;
|
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]);
|
let migration_type = MigrationType::from_filename(parts[1]);
|
||||||
// remove the `.sql` and replace `_` with ` `
|
// remove the `.sql` and replace `_` with ` `
|
||||||
|
Loading…
x
Reference in New Issue
Block a user