Class Deduper
java.lang.Object
com.atlassian.confluence.internal.upgrade.constraint.dedup.Deduper
Remove duplicated rows from a table before a unique constraint can be added.
 This is a 2-step process:
    1. Query all duplicate rows
    2. Use a suitable 
DedupeStrategy to delete those duplicates
 Note:
    1. Tables with composite keys are not supported.
    2. This implementation doesn't scale well because it puts everything in memory and process DMLs one at a time- Since:
- 7.1.0
- 
Constructor SummaryConstructorsConstructorDescriptionDeduper(org.hibernate.SessionFactory sessionFactory, com.atlassian.config.db.HibernateConfig hibernateConfig) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleanOracle and SQL Server behave differently from the rest: two rows that contain nulls for one or more key columns and the same combination of values for the other key columns violate a unique constraint.longremoveDuplicates(String table, String idColumn, List<String> uniqueColumns, DedupeStrategy dedupeStrategy) Remove all duplicates of combination ofuniqueColumnsfromtable.
- 
Constructor Details- 
Deduperpublic Deduper(org.hibernate.SessionFactory sessionFactory, com.atlassian.config.db.HibernateConfig hibernateConfig) 
 
- 
- 
Method Details- 
removeDuplicatespublic long removeDuplicates(String table, String idColumn, List<String> uniqueColumns, DedupeStrategy dedupeStrategy) throws UpgradeException Remove all duplicates of combination ofuniqueColumnsfromtable. Note: names of tables and columns are not to be quoted.- Returns:
- number of duplicate rows removed
- Throws:
- UpgradeException
 
- 
multipleNullsNotAllowedpublic boolean multipleNullsNotAllowed()Oracle and SQL Server behave differently from the rest: two rows that contain nulls for one or more key columns and the same combination of values for the other key columns violate a unique constraint.- Returns:
- true if current SQL vendor doesn't accepts multiple null values in multi-column unique constraints
 
 
-