Class HibernateCheckConstraint
- java.lang.Object
-
- com.atlassian.confluence.upgrade.impl.HibernateCheckConstraint
-
public class HibernateCheckConstraint extends Object
It creates a predicate for checking whether constraint of specified name exists or not.- Since:
- 5.10
-
-
Constructor Summary
Constructors Constructor Description HibernateCheckConstraint()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
checkConstraintsExists(com.atlassian.config.db.HibernateConfig hibernateConfig, org.hibernate.SessionFactory sessionFactory, Map<String,io.atlassian.fugue.Pair<String,List<String>>> expectedConstraints)
Take an expected map of [tablename, pair[constraint name, list[column name for constraint]]], and work out if the given constraints for the given table exists in the database.static boolean
constraintsExists(com.atlassian.config.db.HibernateConfig hibernateConfig, org.hibernate.SessionFactory sessionFactory, Map<String,com.atlassian.fugue.Pair<String,List<String>>> expectedConstraints)
Deprecated.since 7.0.1.static Predicate<String>
createConstraintPredicate(com.atlassian.config.db.HibernateConfig hibernateConfig, org.hibernate.SessionFactory sessionFactory)
Deprecated.since 7.13.17static Predicate<String>
createConstraintPredicate(HibernateDatabaseCapabilities databaseCapabilities, org.hibernate.SessionFactory sessionFactory)
static Map<String,List<String>>
getConstraintsForTable(com.atlassian.config.db.HibernateConfig hibernateConfig, org.hibernate.SessionFactory sessionFactory, @NonNull String tableName)
Return a map of unique contraints and it's columns for the given table.
-
-
-
Method Detail
-
createConstraintPredicate
@Deprecated public static Predicate<String> createConstraintPredicate(com.atlassian.config.db.HibernateConfig hibernateConfig, org.hibernate.SessionFactory sessionFactory)
Deprecated.since 7.13.17
-
createConstraintPredicate
public static Predicate<String> createConstraintPredicate(HibernateDatabaseCapabilities databaseCapabilities, org.hibernate.SessionFactory sessionFactory)
- Since:
- 7.13.17
-
getConstraintsForTable
public static Map<String,List<String>> getConstraintsForTable(com.atlassian.config.db.HibernateConfig hibernateConfig, org.hibernate.SessionFactory sessionFactory, @NonNull String tableName)
Return a map of unique contraints and it's columns for the given table.- Parameters:
tableName
- a table name.- Returns:
- map of (constraint_name -> list(columns_name)). Empty if table doesn't exist, or no unique constraints.
-
constraintsExists
@Deprecated public static boolean constraintsExists(com.atlassian.config.db.HibernateConfig hibernateConfig, org.hibernate.SessionFactory sessionFactory, Map<String,com.atlassian.fugue.Pair<String,List<String>>> expectedConstraints)
Deprecated.since 7.0.1. UsecheckConstraintsExists(HibernateConfig, SessionFactory, Map)
Take an expected map of [tablename, pair[constraint name, list[column name for constraint]]], and work out if the given constraints for the given table exists in the database.- Parameters:
hibernateConfig
- hibernate configsessionFactory
- sessionFactoryexpectedConstraints
- a map of tablename -> pair[constraint name, list[column name for constraint]], of the expected constraints.- Returns:
- true if all of the constraints exist, false otherwise. If any of the table doesn't exist, return false.
-
checkConstraintsExists
public static boolean checkConstraintsExists(com.atlassian.config.db.HibernateConfig hibernateConfig, org.hibernate.SessionFactory sessionFactory, Map<String,io.atlassian.fugue.Pair<String,List<String>>> expectedConstraints)
Take an expected map of [tablename, pair[constraint name, list[column name for constraint]]], and work out if the given constraints for the given table exists in the database.- Parameters:
hibernateConfig
- hibernate configsessionFactory
- sessionFactoryexpectedConstraints
- a map of tablename -> pair[constraint name, list[column name for constraint]], of the expected constraints.- Returns:
- true if all of the constraints exist, false otherwise. If any of the table doesn't exist, return false.
- Since:
- 7.0.1
-
-