Skip to content

Commit

Permalink
Fall back to old message if total is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanslade committed Jan 3, 2025
1 parent 9d2d391 commit c8a6ba0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ func runMigration(ctx context.Context, m *roll.Roll, migration *migrations.Migra
if total > 0 {
percent = float64(n) / float64(total) * 100
}
sp.UpdateText(fmt.Sprintf("%d records complete... (%.2f%%)", n, percent))
if percent > 100 {
// This can happen if we're on the last batch
percent = 100
}
if total > 0 {
sp.UpdateText(fmt.Sprintf("%d records complete... (%.2f%%)", n, percent))
} else {
sp.UpdateText(fmt.Sprintf("%d records complete...", n))
}
}

err := m.Start(ctx, migration, cb)
Expand Down

0 comments on commit c8a6ba0

Please sign in to comment.