Class CreateJsonIndexChange
java.lang.Object
liquibase.AbstractExtensibleObject
liquibase.plugin.AbstractPlugin
liquibase.change.AbstractChange
org.keycloak.models.map.storage.jpa.liquibase.extension.CreateJsonIndexChange
- All Implemented Interfaces:
Cloneable
,liquibase.change.Change
,liquibase.change.ChangeWithColumns<AddGeneratedColumnConfig>
,liquibase.ExtensibleObject
,liquibase.plugin.Plugin
,liquibase.serializer.LiquibaseSerializable
public class CreateJsonIndexChange
extends liquibase.change.AbstractChange
implements liquibase.change.ChangeWithColumns<AddGeneratedColumnConfig>
Extension used to create an index for properties of JSON files stored in the database. Some databases, like
Postgres
,
have native support for these indexes while other databases may require different constructs to achieve this (like creation
of a separate column based on the JSON property and subsequent indexing of that column).
Example configuration in the changelog:
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd"> <changeSet author="keycloak" id="some_id"> ... <ext:createJsonIndex tableName="test" indexName="some_index_name"> <ext:column jsonColumn="metadata" jsonProperty="name"/> </ext:createJsonIndex> </changeSet>The above configuration is creating an inverted (GIN) index for the
name
property of JSON files stored in column
metadata
in table test
.
The jsonProperty
is optional - when it is absent the index will be created for the whole JSON.- Author:
- Stefan Guilhen
-
Nested Class Summary
Nested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable
liquibase.serializer.LiquibaseSerializable.SerializationType
-
Field Summary
Fields inherited from class liquibase.change.AbstractChange
NODENAME_COLUMN
Fields inherited from interface liquibase.change.Change
EMPTY_CHANGE, SHOULD_EXECUTE
Fields inherited from interface liquibase.serializer.LiquibaseSerializable
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACE
Fields inherited from interface liquibase.plugin.Plugin
PRIORITY_DATABASE, PRIORITY_DEFAULT, PRIORITY_NOT_APPLICABLE, PRIORITY_SPECIALIZED
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addColumn
(AddGeneratedColumnConfig column) liquibase.change.ChangeStatus
checkStatus
(liquibase.database.Database database) protected liquibase.change.Change[]
liquibase.statement.SqlStatement[]
generateStatements
(liquibase.database.Database database) getSerializableFieldValue
(String field) isUnique()
void
setAssociatedWith
(String associatedWith) void
setCatalogName
(String catalogName) void
setClustered
(Boolean clustered) void
setColumns
(List<AddGeneratedColumnConfig> columns) void
setIndexName
(String indexName) void
setSchemaName
(String schemaName) void
setTableName
(String tableName) void
setTablespace
(String tablespace) void
Methods inherited from class liquibase.change.AbstractChange
createChangeMetaData, createChangeParameterMetadata, createDescriptionMetaData, createEmptyColumnConfig, createExampleValueMetaData, createMustEqualExistingMetaData, createRequiredDatabasesMetaData, createSerializationTypeMetaData, createSinceMetaData, createSupportedDatabasesMetaData, customLoadLogic, equals, finishInitialization, generateCheckSum, generateRollbackStatements, generateRollbackStatementsVolatile, generateStatementsVolatile, getAffectedDatabaseObjects, getChangeSet, getDescription, getExcludedFieldFilters, getResourceAccessor, getSerializableFieldNamespace, getSerializableFields, getSerializableFieldType, getSerializedObjectName, hashCode, isInvalidProperty, load, serialize, serializeValue, setChangeSet, setResourceAccessor, shouldExecuteChange, supports, supportsRollback, toString, validate, warn
Methods inherited from class liquibase.AbstractExtensibleObject
clone, describe, get, get, get, getAttributes, getFieldValue, getObjectMetaData, getValuePath, has, set
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface liquibase.ExtensibleObject
clone, describe, get, get, getAttributes, getObjectMetaData, getValuePath, has, set
-
Constructor Details
-
CreateJsonIndexChange
public CreateJsonIndexChange()
-
-
Method Details
-
getCatalogName
-
setCatalogName
-
getSchemaName
-
setSchemaName
-
getTableName
-
setTableName
-
getIndexName
-
setIndexName
-
getTablespace
-
setTablespace
-
isUnique
-
setUnique
-
getAssociatedWith
-
setAssociatedWith
-
getClustered
-
setClustered
-
addColumn
- Specified by:
addColumn
in interfaceliquibase.change.ChangeWithColumns<AddGeneratedColumnConfig>
-
getColumns
- Specified by:
getColumns
in interfaceliquibase.change.ChangeWithColumns<AddGeneratedColumnConfig>
-
setColumns
- Specified by:
setColumns
in interfaceliquibase.change.ChangeWithColumns<AddGeneratedColumnConfig>
-
getConfirmationMessage
- Specified by:
getConfirmationMessage
in interfaceliquibase.change.Change
-
generateStatements
public liquibase.statement.SqlStatement[] generateStatements(liquibase.database.Database database) - Specified by:
generateStatements
in interfaceliquibase.change.Change
-
createInverses
protected liquibase.change.Change[] createInverses()- Overrides:
createInverses
in classliquibase.change.AbstractChange
-
checkStatus
public liquibase.change.ChangeStatus checkStatus(liquibase.database.Database database) - Specified by:
checkStatus
in interfaceliquibase.change.Change
- Overrides:
checkStatus
in classliquibase.change.AbstractChange
-
getSerializedObjectNamespace
- Specified by:
getSerializedObjectNamespace
in interfaceliquibase.serializer.LiquibaseSerializable
- Overrides:
getSerializedObjectNamespace
in classliquibase.change.AbstractChange
-
getSerializableFieldValue
- Specified by:
getSerializableFieldValue
in interfaceliquibase.serializer.LiquibaseSerializable
- Overrides:
getSerializableFieldValue
in classliquibase.change.AbstractChange
-