diff --git a/src/main/java/org/folio/fqm/config/MigrationConfiguration.java b/src/main/java/org/folio/fqm/config/MigrationConfiguration.java index 43f21ec5..2243357a 100644 --- a/src/main/java/org/folio/fqm/config/MigrationConfiguration.java +++ b/src/main/java/org/folio/fqm/config/MigrationConfiguration.java @@ -9,7 +9,7 @@ public class MigrationConfiguration { public static final String VERSION_KEY = "_version"; public static final UUID REMOVED_ENTITY_TYPE_ID = UUID.fromString("deadbeef-dead-dead-dead-deaddeadbeef"); - private static final String CURRENT_VERSION = "12"; + private static final String CURRENT_VERSION = "13"; // TODO: replace this with current version in the future? private static final String DEFAULT_VERSION = "0"; diff --git a/src/main/java/org/folio/fqm/migration/MigrationStrategyRepository.java b/src/main/java/org/folio/fqm/migration/MigrationStrategyRepository.java index d9e203b9..eba92a25 100644 --- a/src/main/java/org/folio/fqm/migration/MigrationStrategyRepository.java +++ b/src/main/java/org/folio/fqm/migration/MigrationStrategyRepository.java @@ -10,6 +10,7 @@ import org.folio.fqm.migration.strategies.V0POCMigration; import org.folio.fqm.migration.strategies.V10OrganizationStatusValueChange; import org.folio.fqm.migration.strategies.V11OrganizationCodeOperatorChange; +import org.folio.fqm.migration.strategies.V12PurchaseOrderIdFieldRemoval; import org.folio.fqm.migration.strategies.V1ModeOfIssuanceConsolidation; import org.folio.fqm.migration.strategies.V2ResourceTypeConsolidation; import org.folio.fqm.migration.strategies.V3RamsonsFieldCleanup; @@ -47,7 +48,8 @@ public MigrationStrategyRepository( new V8LocationValueChange(locationsClient), new V9LocLibraryValueChange(locationUnitsClient), new V10OrganizationStatusValueChange(), - new V11OrganizationCodeOperatorChange(organizationsClient) + new V11OrganizationCodeOperatorChange(organizationsClient), + new V12PurchaseOrderIdFieldRemoval() // adding a strategy? be sure to update the `CURRENT_VERSION` in MigrationConfiguration! ); } diff --git a/src/main/java/org/folio/fqm/migration/strategies/V12PurchaseOrderIdFieldRemoval.java b/src/main/java/org/folio/fqm/migration/strategies/V12PurchaseOrderIdFieldRemoval.java new file mode 100644 index 00000000..5223b5f3 --- /dev/null +++ b/src/main/java/org/folio/fqm/migration/strategies/V12PurchaseOrderIdFieldRemoval.java @@ -0,0 +1,55 @@ +package org.folio.fqm.migration.strategies; + +import java.util.Map; +import java.util.UUID; +import java.util.function.BiFunction; +import lombok.RequiredArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.folio.fqm.migration.AbstractSimpleMigrationStrategy; +import org.folio.fqm.migration.warnings.FieldWarning; +import org.folio.fqm.migration.warnings.RemovedFieldWarning; + +/** + * Version 12 -> 13, handles a change in available fields for the POL entity type. + * + * The "PO ID", "PO created by ID", and "POL created by ID" fields were made API-only in Ramsons. + * + * @see https://folio-org.atlassian.net/browse/MODFQMMGR-619 for the addition of this migration + */ +@Log4j2 +@RequiredArgsConstructor +public class V12PurchaseOrderIdFieldRemoval extends AbstractSimpleMigrationStrategy { + + private static final UUID COMPOSITE_PURCHASE_ORDER_LINES_ENTITY_TYPE_ID = UUID.fromString( + "abc777d3-2a45-43e6-82cb-71e8c96d13d2" + ); + + @Override + public String getLabel() { + return "V12 -> V13 POL ID field removal (MODFQMMGR-619)"; + } + + @Override + public String getSourceVersion() { + return "12"; + } + + @Override + public String getTargetVersion() { + return "13"; + } + + @Override + public Map>> getFieldWarnings() { + return Map.ofEntries( + Map.entry( + COMPOSITE_PURCHASE_ORDER_LINES_ENTITY_TYPE_ID, + Map.ofEntries( + Map.entry("po.id", RemovedFieldWarning.withAlternative("po.po_number")), + Map.entry("po_created_by_user.id", RemovedFieldWarning.withAlternative("po_created_by_user.username")), + Map.entry("pol_created_by_user.id", RemovedFieldWarning.withAlternative("pol_created_by_user.username")) + ) + ) + ); + } +}