Top Description Fields Constructors Methods
liquibase.change.core

public Class CreateViewChange

extends AbstractChange
implements ReplaceIfExists
Class Inheritance
All Implemented Interfaces
liquibase.change.ReplaceIfExists
Annotations
@DatabaseChange
name:createView
description:Create a new database view
priority:1
Imports
liquibase.ChecksumVersion, .GlobalConfiguration, .Scope, liquibase.change.*, liquibase.changelog.ChangeLogParameters, .PropertyExpandingStream, liquibase.database.Database, liquibase.database.core.*, liquibase.exception.UnexpectedLiquibaseException, .ValidationErrors, liquibase.parser.core.ParsedNode, .ParsedNodeException, liquibase.resource.ResourceAccessor, liquibase.snapshot.SnapshotGeneratorFactory, liquibase.sqlgenerator.SqlGeneratorFactory, liquibase.statement.SqlStatement, liquibase.statement.core.CreateViewStatement, .DropViewStatement, .SetViewRemarksStatement, liquibase.structure.core.View, liquibase.util.FileUtil, .ObjectUtil, .StreamUtil, .StringUtil, java.io.ByteArrayInputStream, .IOException, .InputStream, .UnsupportedEncodingException, java.nio.charset.Charset, java.util.ArrayList, .Arrays, .List

Creates a new view.

Field Summary

Modifier and TypeField and Description
private String
private String
private Boolean
private String
private Boolean
private String
private Boolean
private String
private String
private String
Inherited from liquibase.change.AbstractChange:
NODENAME_COLUMN

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ChangeStatus
checkStatus(Database database)

Overrides liquibase.change.AbstractChange.checkStatus.

Implements liquibase.change.Change.checkStatus.

Validate that this change executed successfully against the given database.

protected Change[]
createInverses()

Overrides liquibase.change.AbstractChange.createInverses.

Create inverse changes that can roll back this change.

protected CreateViewStatement
createViewStatement(String catalogName, String schemaName, String viewName, String selectQuery, boolean replaceIfExists)

protected void
public CheckSum
generateCheckSum()

Overrides liquibase.change.AbstractChange.generateCheckSum.

Implements liquibase.change.Change.generateCheckSum.

Calculates the checksum based on the contained SQL.

private CheckSum
private CheckSum
generateCheckSumV8()
Deprecated

public SqlStatement[]
generateStatements(Database database)

Implements liquibase.change.Change.generateStatements.

Generates the SqlStatement objects required to run the change for the given database.

public boolean
public String
public String
getConfirmationMessage()

Implements liquibase.change.Change.getConfirmationMessage.

Confirmation message to be displayed after the change is executed.

public String
public String[]
public Boolean
public String
public Boolean
public String
public Boolean
public String
public String
public String
public String
protected InputStream
public void
setCatalogName(String catalogName)

public void
setEncoding(String encoding)

public void
setFullDefinition(Boolean fullDefinition)

public void
public void
setRelativeToChangelogFile(Boolean relativeToChangelogFile)

public void
setRemarks(String remarks)

public void
public void
setSchemaName(String schemaName)

public void
setSelectQuery(String selectQuery)

public void
setViewName(String viewName)

private boolean
public ValidationErrors
validate(Database database)

Overrides liquibase.change.AbstractChange.validate.

Implements liquibase.change.Change.validate.

Implementation checks the ChangeParameterMetaData for declared required fields and also delegates logic to the liquibase.sqlgenerator.SqlGenerator#validate(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain) method on the SqlStatement objects returned by generateStatements.

Inherited from liquibase.change.AbstractChange:
createChangeMetaDatacreateChangeParameterMetadatacreateDescriptionMetaDatacreateEmptyColumnConfigcreateExampleValueMetaDatacreateMustEqualExistingMetaDatacreateRequiredDatabasesMetaDatacreateSerializationTypeMetaDatacreateSinceMetaDatacreateSupportedDatabasesMetaDataequalsfinishInitializationgenerateRollbackStatementsgenerateRollbackStatementsVolatilegetAffectedDatabaseObjectsgetChangeSetgetDescriptiongetResourceAccessorgetSerializableFieldNamespacegetSerializableFieldsgetSerializableFieldTypegetSerializableFieldValuegetSerializedObjectNamehashCodeisInvalidPropertyloadmodifyserializeserializeValuesetChangeSetsetResourceAccessorshouldExecuteChangesupportssupportsRollbacktoStringwarn

Field Detail

catalogNameback to summary
private String catalogName
encodingback to summary
private String encoding
fullDefinitionback to summary
private Boolean fullDefinition
pathback to summary
private String path
relativeToChangelogFileback to summary
private Boolean relativeToChangelogFile
remarksback to summary
private String remarks
replaceIfExistsback to summary
private Boolean replaceIfExists
schemaNameback to summary
private String schemaName
selectQueryback to summary
private String selectQuery
viewNameback to summary
private String viewName

Constructor Detail

CreateViewChangeback to summary
public CreateViewChange()

Method Detail

checkStatusback to summary
public ChangeStatus checkStatus(Database database)

Overrides liquibase.change.AbstractChange.checkStatus.

Implements liquibase.change.Change.checkStatus.

Doc from liquibase.change.Change.checkStatus.

Validate that this change executed successfully against the given database. This will check that the update completed at a high level plus check details of the change. For example, a change to add a column will check that the column exists plus data type, default values, etc.

Annotations
@Override
createInversesback to summary
protected Change[] createInverses()

Overrides liquibase.change.AbstractChange.createInverses.

Doc from liquibase.change.AbstractChange.createInverses.

Create inverse changes that can roll back this change. This method is intended to be overridden by Change implementations that have a logical inverse operation. Default implementation returns null.

If generateRollbackStatements(liquibase.database.Database) is overridden, this method may not be called.

Returns:Change[]

Return null if there is no corresponding inverse and therefore automatic rollback is not possible. Return an empty array to have a no-op rollback.

Annotations
@Override
createViewStatementback to summary
protected CreateViewStatement createViewStatement(String catalogName, String schemaName, String viewName, String selectQuery, boolean replaceIfExists)
customLoadLogicback to summary
protected void customLoadLogic(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException

Overrides liquibase.change.AbstractChange.customLoadLogic.

Annotations
@Override
generateCheckSumback to summary
public CheckSum generateCheckSum()

Overrides liquibase.change.AbstractChange.generateCheckSum.

Implements liquibase.change.Change.generateCheckSum.

Calculates the checksum based on the contained SQL.

Annotations
@Override
See Also
Change#generateCheckSum(ChecksumVersion)
generateCheckSumLatestback to summary
private CheckSum generateCheckSumLatest(ChecksumVersion version)
generateCheckSumV8back to summary
private CheckSum generateCheckSumV8()

Deprecated

Annotations
@Deprecated
generateStatementsback to summary
public SqlStatement[] generateStatements(Database database)

Implements liquibase.change.Change.generateStatements.

Doc from liquibase.change.Change.generateStatements.

Generates the SqlStatement objects required to run the change for the given database.

NOTE: This method may be called multiple times throughout the changelog execution process and may be called in documentation generation and other integration points as well.

If this method reads from the current database state or uses any other logic that will be affected by whether previous changeSets have ran or not, you must return true from generateStatementsVolatile.
Annotations
@Override
generateStatementsVolatileback to summary
public boolean generateStatementsVolatile(Database database)

Overrides liquibase.change.AbstractChange.generateStatementsVolatile.

Implements liquibase.change.Change.generateStatementsVolatile.

Doc from liquibase.change.AbstractChange.generateStatementsVolatile.

Implementation delegates logic to the liquibase.sqlgenerator.SqlGenerator#generateStatementsIsVolatile(Database) method on the SqlStatement objects returned by generateStatements. If zero or null SqlStatements are returned by generateStatements then this method returns false.

Annotations
@Override
getCatalogNameback to summary
public String getCatalogName()
Annotations
@DatabaseChangeProperty
since:3.0
description:Name of the database catalog
getConfirmationMessageback to summary
public String getConfirmationMessage()

Implements liquibase.change.Change.getConfirmationMessage.

Doc from liquibase.change.Change.getConfirmationMessage.

Confirmation message to be displayed after the change is executed. Should include relevant configuration settings to make it as helpful as possible. This method may be called outside the changelog execution process, such as in documentation generation.

Annotations
@Override
getEncodingback to summary
public String getEncoding()
Annotations
@DatabaseChangeProperty
description:Encoding used in the file you specify in \'path\'
getExcludedFieldFiltersback to summary
public String[] getExcludedFieldFilters(ChecksumVersion version)

Overrides liquibase.change.AbstractChange.getExcludedFieldFilters.

Annotations
@Override
getFullDefinitionback to summary
public Boolean getFullDefinition()
Annotations
@DatabaseChangeProperty
since:3.3
description:Set to true if selectQuery is the entire view definition. Set to false if the CREATE VIEW header should be added
getPathback to summary
public String getPath()
Annotations
@DatabaseChangeProperty
description:Path to the file containing the view definition. Specifying \'path\' is an alternative to selectQuery.
since:3.6
getRelativeToChangelogFileback to summary
public Boolean getRelativeToChangelogFile()
Annotations
@DatabaseChangeProperty
description:Specifies whether the file path is relative to the changelog file rather than looked up in the search path. Default: false.
getRemarksback to summary
public String getRemarks()
Annotations
@DatabaseChangeProperty
description:A brief descriptive comment stored in the view metadata
getReplaceIfExistsback to summary
public Boolean getReplaceIfExists()
Annotations
@DatabaseChangeProperty
description:Use \'CREATE OR REPLACE\' syntax
since:1.5
getSchemaNameback to summary
public String getSchemaName()
Annotations
@DatabaseChangeProperty
description:Name of the database schema
getSelectQueryback to summary
public String getSelectQuery()
Annotations
@DatabaseChangeProperty
serializationType:DIRECT_VALUE
description:SQL for generating the view
exampleValue:SELECT id, name FROM person WHERE id > 10
getSerializedObjectNamespaceback to summary
public String getSerializedObjectNamespace()

Overrides liquibase.change.AbstractChange.getSerializedObjectNamespace.

Implements liquibase.serializer.LiquibaseSerializable.getSerializedObjectNamespace.

Annotations
@Override
getViewNameback to summary
public String getViewName()
Annotations
@DatabaseChangeProperty
description:Name of the view to create
openSqlStreamback to summary
protected InputStream openSqlStream() throws IOException
setCatalogNameback to summary
public void setCatalogName(String catalogName)
setEncodingback to summary
public void setEncoding(String encoding)
setFullDefinitionback to summary
public void setFullDefinition(Boolean fullDefinition)
setPathback to summary
public void setPath(String path)
setRelativeToChangelogFileback to summary
public void setRelativeToChangelogFile(Boolean relativeToChangelogFile)
setRemarksback to summary
public void setRemarks(String remarks)
setReplaceIfExistsback to summary
public void setReplaceIfExists(Boolean replaceIfExists)

Implements liquibase.change.ReplaceIfExists.setReplaceIfExists.

Annotations
@Override
setSchemaNameback to summary
public void setSchemaName(String schemaName)
setSelectQueryback to summary
public void setSelectQuery(String selectQuery)
setViewNameback to summary
public void setViewName(String viewName)
supportsReplaceIfExistsOptionback to summary
private boolean supportsReplaceIfExistsOption(Database database)
validateback to summary
public ValidationErrors validate(Database database)

Overrides liquibase.change.AbstractChange.validate.

Implements liquibase.change.Change.validate.

Doc from liquibase.change.AbstractChange.validate.

Implementation checks the ChangeParameterMetaData for declared required fields and also delegates logic to the liquibase.sqlgenerator.SqlGenerator#validate(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain) method on the SqlStatement objects returned by generateStatements. If no or null SqlStatements are returned by generateStatements then this method returns no errors. If there are no parameters than this method returns no errors

Annotations
@Override