Package liquibase.snapshot.jvm
Class UniqueConstraintSnapshotGenerator
java.lang.Object
liquibase.snapshot.jvm.JdbcSnapshotGenerator
liquibase.snapshot.jvm.UniqueConstraintSnapshotGenerator
- All Implemented Interfaces:
SnapshotGenerator
- Direct Known Subclasses:
UniqueConstraintSnapshotGeneratorSnowflake
-
Field Summary
Fields inherited from interface liquibase.snapshot.SnapshotGenerator
PRIORITY_ADDITIONAL, PRIORITY_DATABASE, PRIORITY_DEFAULT, PRIORITY_NONE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addTo
(DatabaseObject foundObject, DatabaseSnapshot snapshot) protected String
getCacheKey
(Map<String, ?> row, Database database) Return the cache key for the given query row.protected String
getCacheKey
(UniqueConstraint example, Database database) Return the cache key for the given UniqueConstraint.int
getPriority
(Class<? extends DatabaseObject> objectType, Database database) Inquire if this SnapshotGenerator is capable of snapshotting objects of type objectType (e.g.protected boolean
includeTableNameInCacheKey
(Database database) Should the given database include the table name in the key?listColumns
(UniqueConstraint example, Database database, DatabaseSnapshot snapshot) listConstraints
(Table table, DatabaseSnapshot snapshot, Schema schema) protected DatabaseObject
snapshotObject
(DatabaseObject example, DatabaseSnapshot snapshot) protected boolean
supportsBulkQuery
(Database database) To support bulk query, the resultSet must include a CONSTRAINT_CONTAINER column for caching purposesMethods inherited from class liquibase.snapshot.jvm.JdbcSnapshotGenerator
addStatusListener, addsTo, cleanNameFromDatabase, getDatabaseCatalogNames, replaces, shouldAddTo, snapshot, updateListeners
-
Constructor Details
-
UniqueConstraintSnapshotGenerator
public UniqueConstraintSnapshotGenerator()
-
-
Method Details
-
getPriority
Description copied from interface:SnapshotGenerator
Inquire if this SnapshotGenerator is capable of snapshotting objects of type objectType (e.g. Table, Index, View etc.) in the DBMS database (e.g. Oracle, Postgres, HyperSQL etc.) A return priority of > 0 will be interpreted as capable. The highest priority for an objectType-database combination wins.- Specified by:
getPriority
in interfaceSnapshotGenerator
- Overrides:
getPriority
in classJdbcSnapshotGenerator
- Parameters:
objectType
- The object type we are asked to snapshotdatabase
- The DBMS for which the snapshotting should be done- Returns:
- An integer of PRIORITY_... constants indicating our capability and willingness to snapshot
-
snapshotObject
protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot snapshot) throws DatabaseException - Specified by:
snapshotObject
in classJdbcSnapshotGenerator
- Throws:
DatabaseException
-
addTo
protected void addTo(DatabaseObject foundObject, DatabaseSnapshot snapshot) throws DatabaseException - Specified by:
addTo
in classJdbcSnapshotGenerator
- Throws:
DatabaseException
-
listConstraints
protected List<CachedRow> listConstraints(Table table, DatabaseSnapshot snapshot, Schema schema) throws DatabaseException, SQLException - Throws:
DatabaseException
SQLException
-
listColumns
protected List<Map<String,?>> listColumns(UniqueConstraint example, Database database, DatabaseSnapshot snapshot) throws DatabaseException - Throws:
DatabaseException
-
includeTableNameInCacheKey
Should the given database include the table name in the key? Databases that need to include the table names are ones where unique constraint names do not have to be unique within the schema.Currently only mysql is known to have non-unique constraint names.
If this returns true, the database-specific query in
listColumns(UniqueConstraint, Database, DatabaseSnapshot)
must include a TABLE_NAME column in the results forgetCacheKey(Map, Database)
to use. -
getCacheKey
Return the cache key for the given UniqueConstraint. Must return the same result asgetCacheKey(Map, Database)
. Default implementation usesincludeTableNameInCacheKey(Database)
to determine if the table name should be included in the key or not. -
getCacheKey
Return the cache key for the given query row. Must return the same result asgetCacheKey(UniqueConstraint, Database)
Default implementation usesincludeTableNameInCacheKey(Database)
to determine if the table name should be included in the key or not. -
supportsBulkQuery
To support bulk query, the resultSet must include a CONSTRAINT_CONTAINER column for caching purposes
-