Return code from `cta-catalogue-schema-verify` should indicate if the schema is in UPGRADING state
Currently cta-catalogue-schema-verify
returns 0
on success and 1
on failure, see VerifySchemaCmd.cpp
:
if(result.getStatus() == SchemaCheckerResult::Status::FAILED){
return 1;
}
return 0;
The schema upgrade container needs to be able to distinguish when the DB is in UPGRADING state, to allow idempotent upgrades/recovery from a partially-failed upgrade.
I propose that in the case that status is SchemaCheckerResult::Status::FAILED
and the DB is in UPGRADING
state, we return 2
instead of 1
. The container script can then proceed to execute Liquibase (perhaps with ARE YOU SURE (Y/N)?
)
The text output should still show all the inconsistencies, with an additional message to say that the DB is in an inconsistent state.