Class CreateJsonIndexChange

  • All Implemented Interfaces:
    Cloneable, liquibase.change.Change, liquibase.change.ChangeWithColumns<JsonEnabledColumnConfig>, liquibase.ExtensibleObject, liquibase.plugin.Plugin, liquibase.serializer.LiquibaseSerializable

    public class CreateJsonIndexChange
    extends liquibase.change.AbstractChange
    implements liquibase.change.ChangeWithColumns<JsonEnabledColumnConfig>
    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 index for the name property of JSON files stored in column metadata in table test.
    Author:
    Stefan Guilhen
    • Constructor Detail

      • CreateJsonIndexChange

        public CreateJsonIndexChange()
    • Method Detail

      • getCatalogName

        public String getCatalogName()
      • setCatalogName

        public void setCatalogName​(String catalogName)
      • getSchemaName

        public String getSchemaName()
      • setSchemaName

        public void setSchemaName​(String schemaName)
      • getTableName

        public String getTableName()
      • setTableName

        public void setTableName​(String tableName)
      • getIndexName

        public String getIndexName()
      • setIndexName

        public void setIndexName​(String indexName)
      • getTablespace

        public String getTablespace()
      • setTablespace

        public void setTablespace​(String tablespace)
      • isUnique

        public Boolean isUnique()
      • setUnique

        public void setUnique​(Boolean isUnique)
      • getAssociatedWith

        public String getAssociatedWith()
      • setAssociatedWith

        public void setAssociatedWith​(String associatedWith)
      • getClustered

        public Boolean getClustered()
      • setClustered

        public void setClustered​(Boolean clustered)
      • getConfirmationMessage

        public String getConfirmationMessage()
        Specified by:
        getConfirmationMessage in interface liquibase.change.Change
      • generateStatements

        public liquibase.statement.SqlStatement[] generateStatements​(liquibase.database.Database database)
        Specified by:
        generateStatements in interface liquibase.change.Change
      • createInverses

        protected liquibase.change.Change[] createInverses()
        Overrides:
        createInverses in class liquibase.change.AbstractChange
      • checkStatus

        public liquibase.change.ChangeStatus checkStatus​(liquibase.database.Database database)
        Specified by:
        checkStatus in interface liquibase.change.Change
        Overrides:
        checkStatus in class liquibase.change.AbstractChange
      • getSerializedObjectNamespace

        public String getSerializedObjectNamespace()
        Specified by:
        getSerializedObjectNamespace in interface liquibase.serializer.LiquibaseSerializable
        Overrides:
        getSerializedObjectNamespace in class liquibase.change.AbstractChange
      • getSerializableFieldValue

        public Object getSerializableFieldValue​(String field)
        Specified by:
        getSerializableFieldValue in interface liquibase.serializer.LiquibaseSerializable
        Overrides:
        getSerializableFieldValue in class liquibase.change.AbstractChange