From c8a6ba060669626a966e6f6de149d82870f8de27 Mon Sep 17 00:00:00 2001 From: Ryan Slade Date: Fri, 3 Jan 2025 13:31:42 +0100 Subject: [PATCH] Fall back to old message if total is zero --- cmd/start.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/start.go b/cmd/start.go index 49754f2b..21e64b20 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -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)