Skip to content

Commit df01ac4

Browse files
authored
fix(CLI): Multiple migrations (#11791)
we were exiting instead of continuing on migrating for multiple sources. Introduced here #11655
1 parent 16070bd commit df01ac4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cli/cmd/migrate.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ func migrate(cmd *cobra.Command, args []string) error {
8888
fmt.Println(err)
8989
}
9090
}()
91-
9291
for _, source := range sources {
9392
cl := managedSourceClients.ClientByName(source.Name)
9493
versions, err := cl.Versions(ctx)
@@ -116,9 +115,13 @@ func migrate(cmd *cobra.Command, args []string) error {
116115
return fmt.Errorf("destination %[1]s does not support CloudQuery SDK version 1. Please upgrade to newer version of %[1]s", destination.Name())
117116
}
118117
}
119-
return migrateConnectionV2(ctx, cl, destinationClientsForSource, *source, destinationForSourceSpec)
118+
if err := migrateConnectionV2(ctx, cl, destinationClientsForSource, *source, destinationForSourceSpec); err != nil {
119+
return fmt.Errorf("failed to migrate source %v@%v: %w", source.Name, source.Version, err)
120+
}
120121
case 1:
121-
return migrateConnectionV1(ctx, cl, destinationClientsForSource, *source, destinationForSourceSpec)
122+
if err := migrateConnectionV1(ctx, cl, destinationClientsForSource, *source, destinationForSourceSpec); err != nil {
123+
return fmt.Errorf("failed to migrate source %v@%v: %w", source.Name, source.Version, err)
124+
}
122125
case 0:
123126
return fmt.Errorf("please upgrade your source or use a CLI version between v3.0.1 and v3.5.3")
124127
case -1:

0 commit comments

Comments
 (0)