Skip to content

Commit

Permalink
Add db migration to fix missing token association for claimed airdrop…
Browse files Browse the repository at this point in the history
…s (0.119) (#9878)

- Add a db migration to fix missing token association for claimed airdrops

Signed-off-by: Xin Li <xin@hashgraph.com>
  • Loading branch information
xin-hedera authored Dec 6, 2024
1 parent 653bafe commit 8481dcb
Show file tree
Hide file tree
Showing 5 changed files with 1,084 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hedera.mirror.importer.migration;

import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.flywaydb.core.api.configuration.Configuration;

abstract class ConfigurableJavaMigration extends AbstractJavaMigration {

private static final MigrationProperties DEFAULT_MIGRATION_PROPERTIES = new MigrationProperties();

protected final MigrationProperties migrationProperties;

protected ConfigurableJavaMigration(Map<String, MigrationProperties> migrationPropertiesMap) {
String propertiesKey = StringUtils.uncapitalize(getClass().getSimpleName());
migrationProperties = migrationPropertiesMap.getOrDefault(propertiesKey, DEFAULT_MIGRATION_PROPERTIES);
}

@Override
protected boolean skipMigration(Configuration configuration) {
if (!migrationProperties.isEnabled()) {
log.info("Skip migration since it's disabled");
return true;
}

return super.skipMigration(configuration);
}
}
Loading

0 comments on commit 8481dcb

Please sign in to comment.