Skip to content

Commit

Permalink
warn when migration file name is malformed
Browse files Browse the repository at this point in the history
  • Loading branch information
lgmys committed Sep 25, 2020
1 parent f6b90af commit e1f5aaa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion refinery_core/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,18 @@ pub fn find_migration_files(
// filter by migration file regex
.filter(
move |entry| match entry.file_name().and_then(OsStr::to_str) {
Some(file_name) => re.is_match(file_name),
Some(file_name) => {
if re.is_match(file_name) {
true
} else {
log::warn!(
"File \"{}\" does not adhere to the migration naming convention. Migrations must be named in the format [U|V]{{1}}__{{2}}.sql or [U|V]{{1}}__{{2}}.rs, where {{1}} represents the migration version and {{2}} the name.",
file_name
);

false
}
}
None => false,
},
);
Expand Down

0 comments on commit e1f5aaa

Please sign in to comment.