Class MergeToSmallestIdDedupeStrategy
java.lang.Object
com.atlassian.confluence.internal.upgrade.constraint.dedup.KeepOneDedupeStrategy
com.atlassian.confluence.internal.upgrade.constraint.dedup.KeepSmallestIdDedupeStrategy
com.atlassian.confluence.internal.upgrade.constraint.dedup.MergeToSmallestIdDedupeStrategy
- All Implemented Interfaces:
DedupeStrategy
2 steps:
1. Move all child records from referencing others to referencing the record with smallest Id
2. Delete others
- Since:
- 7.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classHold information about a table having a foreign key referencing current table This implementation only support simple foreign keys i.e. -
Constructor Summary
ConstructorsConstructorDescriptionMergeToSmallestIdDedupeStrategy(String table, String idColumn, Collection<MergeToSmallestIdDedupeStrategy.ReferencedTable> referencedTables) -
Method Summary
Methods inherited from class com.atlassian.confluence.internal.upgrade.constraint.dedup.KeepSmallestIdDedupeStrategy
getIdToKeep
-
Constructor Details
-
MergeToSmallestIdDedupeStrategy
public MergeToSmallestIdDedupeStrategy(String table, String idColumn, Collection<MergeToSmallestIdDedupeStrategy.ReferencedTable> referencedTables)
-
-
Method Details
-
perform
public void perform(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, SortedSet<Object> ids) throws UpgradeException Description copied from interface:DedupeStrategyRemove duplicates so a unique constraint can be added- Specified by:
performin interfaceDedupeStrategy- Overrides:
performin classKeepOneDedupeStrategy- Parameters:
jdbcTemplate- AJdbcTemplateto be usedids- Set of Ids of duplicate rows in DB. Upon invocation of this method, only one of them can remain in the DB. All Confluence primary keys are of type Long or String so they can be used inSortedSet.- Throws:
UpgradeException- Thrown if there is any error removing duplicates, will cancel the constraint adding process
-