From dae5198bd77df1ddaf5849e2cdf86cb7cbf4874d Mon Sep 17 00:00:00 2001 From: hongwei Date: Fri, 16 Dec 2022 10:57:01 +0100 Subject: [PATCH] bugfix/run bankAccountHoldersAndOwnerViewAccessInfo after OBP Schemifier --- .../scala/code/api/util/migration/Migration.scala | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/obp-api/src/main/scala/code/api/util/migration/Migration.scala b/obp-api/src/main/scala/code/api/util/migration/Migration.scala index 0b3add21b..a38a8a1f8 100644 --- a/obp-api/src/main/scala/code/api/util/migration/Migration.scala +++ b/obp-api/src/main/scala/code/api/util/migration/Migration.scala @@ -68,7 +68,7 @@ object Migration extends MdcLoggable { generateAndPopulateMissingConsumersUUIDs(startedBeforeSchemifier) populateTableRateLimiting() updateTableViewDefinition() - bankAccountHoldersAndOwnerViewAccessInfo() + bankAccountHoldersAndOwnerViewAccessInfo(startedBeforeSchemifier) alterTableMappedConsent() alterColumnChallengeAtTableMappedConsent() alterTableOpenIDConnectToken() @@ -183,10 +183,15 @@ object Migration extends MdcLoggable { } } - private def bankAccountHoldersAndOwnerViewAccessInfo(): Boolean = { - val name = nameOf(bankAccountHoldersAndOwnerViewAccessInfo) - runOnce(name) { - BankAccountHoldersAndOwnerViewAccess.saveInfoBankAccountHoldersAndOwnerViewAccessInfo(name) + private def bankAccountHoldersAndOwnerViewAccessInfo(startedBeforeSchemifier: Boolean): Boolean = { + if(startedBeforeSchemifier == true) { + logger.warn(s"Migration.database.bankAccountHoldersAndOwnerViewAccessInfo(true) cannot be run before Schemifier.") + true + } else { + val name = nameOf(bankAccountHoldersAndOwnerViewAccessInfo(startedBeforeSchemifier)) + runOnce(name) { + BankAccountHoldersAndOwnerViewAccess.saveInfoBankAccountHoldersAndOwnerViewAccessInfo(name) + } } } private def alterTableMappedConsent(): Boolean = {