don't assume that migrations are already sorted

This commit is contained in:
Dull Bananas 2024-11-19 23:36:35 -07:00
parent 7fcaca0cb1
commit 2ef89bddb9

View file

@ -275,7 +275,13 @@ fn run_selected_migrations(
.enable_diff_check .enable_diff_check
.then(|| diesel::migration::MigrationSource::<Pg>::migrations(&migrations())) .then(|| diesel::migration::MigrationSource::<Pg>::migrations(&migrations()))
.transpose()? .transpose()?
.and_then(|migrations| Some(migrations.last()?.name().to_string())), // Get the migration with the highest version
.and_then(|migrations| {
migrations
.into_iter()
.map(|migration| migration.name().to_string())
.max()
}),
}; };
if options.revert { if options.revert {