From e4c14dbac59134431b77ee6205489abf281b349f Mon Sep 17 00:00:00 2001 From: Valentin Kuznetsov Date: Mon, 29 Aug 2022 17:10:57 -0400 Subject: [PATCH] update migration_block query and return completed status if it migration is done --- dbs/migrate.go | 6 ++++++ static/sql/migration_block.sql | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dbs/migrate.go b/dbs/migrate.go index ac90ba46..17091c89 100644 --- a/dbs/migrate.go +++ b/dbs/migrate.go @@ -999,6 +999,12 @@ func (a *API) ProcessMigration() { log.Printf("query='%s' args='%v' error=%v", stm, args, err) return } + // if status of migration block is completed then we update status of migration request + if bid != 0 && bStatus == int64(COMPLETED) { + status = COMPLETED + updateMigrationStatus(mrec, COMPLETED) + return + } // check if our migration input is block name or dataset if !strings.Contains(migInput, "#") { diff --git a/static/sql/migration_block.sql b/static/sql/migration_block.sql index d2255b91..e2983ce1 100644 --- a/static/sql/migration_block.sql +++ b/static/sql/migration_block.sql @@ -5,4 +5,3 @@ SELECT MIGRATION_STATUS FROM {{.Owner}}.MIGRATION_BLOCKS WHERE MIGRATION_REQUEST_ID=:migration_request_id -AND (MIGRATION_STATUS=0 or MIGRATION_STATUS=1 or MIGRATION_STATUS=3) ORDER BY MIGRATION_ORDER DESC