From 5f5c13ca3ca6200f3c4344f7be297d2792673f6b Mon Sep 17 00:00:00 2001 From: priyanshi-yb Date: Fri, 27 Dec 2024 16:33:41 +0530 Subject: [PATCH] Fix retrieving migration uuid in export schema --- yb-voyager/cmd/exportSchema.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/yb-voyager/cmd/exportSchema.go b/yb-voyager/cmd/exportSchema.go index 092a87c39..920f3cb2d 100644 --- a/yb-voyager/cmd/exportSchema.go +++ b/yb-voyager/cmd/exportSchema.go @@ -66,6 +66,11 @@ var exportSchemaCmd = &cobra.Command{ } func exportSchema() error { + err := retrieveMigrationUUID() + if err != nil { + log.Errorf("failed to get migration UUID: %v", err) + return fmt.Errorf("failed to get migration UUID: %w", err) + } if metaDBIsCreated(exportDir) && schemaIsExported() { if startClean { proceed := utils.AskPrompt( @@ -93,7 +98,7 @@ func exportSchema() error { utils.PrintAndLog("export of schema for source type as '%s'\n", source.DBType) // Check connection with source database. - err := source.DB().Connect() + err = source.DB().Connect() if err != nil { log.Errorf("failed to connect to the source db: %s", err) return fmt.Errorf("failed to connect to the source db: %w", err) @@ -153,12 +158,6 @@ func exportSchema() error { } } - err = retrieveMigrationUUID() - if err != nil { - log.Errorf("failed to get migration UUID: %v", err) - return fmt.Errorf("failed to get migration UUID: %w", err) - } - exportSchemaStartEvent := createExportSchemaStartedEvent() controlPlane.ExportSchemaStarted(&exportSchemaStartEvent)