Top Fields Constructors Methods
liquibase.change.core

public Class CreateProcedureChange

extends AbstractChange
implements DbmsTargetedChange, ReplaceIfExists
Class Inheritance
All Implemented Interfaces
liquibase.change.ReplaceIfExists, liquibase.change.DbmsTargetedChange
Annotations
@DatabaseChange
name:createProcedure
description:Defines a stored procedure.
priority:1
Imports
liquibase.ChecksumVersion, .GlobalConfiguration, .Scope, liquibase.change.*, liquibase.changelog.ChangeLogParameters, .PropertyExpandingStream, liquibase.database.Database, .DatabaseList, liquibase.database.core.*, liquibase.exception.DatabaseException, .UnexpectedLiquibaseException, .ValidationErrors, liquibase.resource.ResourceAccessor, liquibase.statement.SqlStatement, liquibase.statement.core.CreateProcedureStatement, liquibase.util.FileUtil, .StreamUtil, .StringUtil, java.io.ByteArrayInputStream, .IOException, .InputStream, .UnsupportedEncodingException, java.nio.charset.Charset, java.util.Map

Field Summary

Modifier and TypeField and Description
private String
private String
private String
private String
private String
private String
private String
private final String
private Boolean
private Boolean
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 Map<String, Object>
private static boolean
public CheckSum
generateCheckSum()

Overrides liquibase.change.AbstractChange.generateCheckSum.

Implements liquibase.change.Change.generateCheckSum.

Calculates the checksum based on the contained SQL.

protected CheckSum
private CheckSum
generateCheckSumV8()
Deprecated

public boolean
generateRollbackStatementsVolatile(Database database)

Overrides liquibase.change.AbstractChange.generateRollbackStatementsVolatile.

Implements liquibase.change.Change.generateRollbackStatementsVolatile.

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

public SqlStatement[]
generateStatements(Database database)

Implements liquibase.change.Change.generateStatements.

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

protected SqlStatement[]
generateStatements(String logicText, String endDelimiter, Database database)

public boolean
public String
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 String[]
getExcludedFieldFilters(ChecksumVersion version)

Overrides liquibase.change.AbstractChange.getExcludedFieldFilters.

Listing SQL content fields (for example procedureText, triggerBody, etc.) we don't want to include as part of the checksum computes, because have a separate part that computes that checksum for that part doing the "normalizing" logic, so it is not impacted by the reformatting of the SQL.

public String
public String
public String
public String
public Boolean
public String
public String
public Boolean
public InputStream
public void
setCatalogName(String catalogName)

public void
setComments(String comments)

public void
public void
setEncoding(String encoding)

public void
public void
setProcedureBody(String procedureText)
Deprecated Use setProcedureText() instead

public void
setProcedureName(String procedureName)

public void
setProcedureText(String procedureText)

public void
setRelativeToChangelogFile(Boolean relativeToChangelogFile)

public void
public void
setSchemaName(String schemaName)

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:
createChangeMetaDatacreateChangeParameterMetadatacreateDescriptionMetaDatacreateEmptyColumnConfigcreateInversescreateMustEqualExistingMetaDatacreateRequiredDatabasesMetaDatacreateSerializationTypeMetaDatacreateSinceMetaDatacreateSupportedDatabasesMetaDatacustomLoadLogicequalsfinishInitializationgenerateRollbackStatementsgetAffectedDatabaseObjectsgetChangeSetgetDescriptiongetResourceAccessorgetSerializableFieldNamespacegetSerializableFieldsgetSerializableFieldTypegetSerializableFieldValuegetSerializedObjectNamehashCodeisInvalidPropertyloadmodifyserializeserializeValuesetChangeSetsetResourceAccessorshouldExecuteChangesupportssupportsRollbacktoStringwarn

Field Detail

catalogNameback to summary
private String catalogName
commentsback to summary
private String comments
dbmsback to summary
private String dbms
encodingback to summary
private String encoding
pathback to summary
private String path
procedureNameback to summary
private String procedureName
procedureTextback to summary
private String procedureText
procedureTextDescriptionback to summary
private final String procedureTextDescription
relativeToChangelogFileback to summary
private Boolean relativeToChangelogFile
replaceIfExistsback to summary
private Boolean replaceIfExists
schemaNameback to summary
private String schemaName

Constructor Detail

CreateProcedureChangeback to summary
public CreateProcedureChange()

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
createExampleValueMetaDataback to summary
protected Map<String, Object> createExampleValueMetaData(String parameterName, DatabaseChangeProperty changePropertyAnnotation)

Overrides liquibase.change.AbstractChange.createExampleValueMetaData.

Doc from liquibase.change.AbstractChange.createExampleValueMetaData.

Create the ChangeParameterMetaData "example" value. Uses the value on the DatabaseChangeProperty annotation or returns null as a default. Returns map with key=database short name, value=example. Use short-name "all" as the fallback.

Annotations
@SuppressWarnings:java:S2095
@Override
databaseSupportsReplaceIfExistsback to summary
private static boolean databaseSupportsReplaceIfExists(Database database)
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()
generateCheckSumLatestback to summary
protected CheckSum generateCheckSumLatest(String sqlText)
generateCheckSumV8back to summary
private CheckSum generateCheckSumV8()

Deprecated

Annotations
@Deprecated
generateRollbackStatementsVolatileback to summary
public boolean generateRollbackStatementsVolatile(Database database)

Overrides liquibase.change.AbstractChange.generateRollbackStatementsVolatile.

Implements liquibase.change.Change.generateRollbackStatementsVolatile.

Doc from liquibase.change.AbstractChange.generateRollbackStatementsVolatile.

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

Annotations
@Override
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
generateStatementsback to summary
protected SqlStatement[] generateStatements(String logicText, String endDelimiter, Database database)
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
description:Name of the database catalog
getCommentsback to summary
public String getComments()
Annotations
@DatabaseChangeProperty
description:Inline comments generated by update-sql. Not applied to the database
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
getDbmsback to summary
public String getDbms()

Implements liquibase.change.DbmsTargetedChange.getDbms.

Returns:String

Doc from liquibase.change.DbmsTargetedChange.getDbms.

A comma separated list of dbms' that this change will be run for. Will run for all dbms' if empty or null.

Annotations
@Override
@DatabaseChangeProperty
exampleValue:h2, oracle
since:3.1
description:Specifies which database type(s) a changeset is to be used for. See valid database type names on Supported Databases docs page. Separate multiple databases with commas. Specify that a changeset is not applicable to a particular database type by prefixing with !. The keywords \'all\' and \'none\' are also available.
getEncodingback to summary
public String getEncoding()
Annotations
@DatabaseChangeProperty
exampleValue:utf8
description:Encoding used in the file you specify in \'path\'
getExcludedFieldFiltersback to summary
public String[] getExcludedFieldFilters(ChecksumVersion version)

Overrides liquibase.change.AbstractChange.getExcludedFieldFilters.

Listing SQL content fields (for example procedureText, triggerBody, etc.) we don't want to include as part of the checksum computes, because have a separate part that computes that checksum for that part doing the "normalizing" logic, so it is not impacted by the reformatting of the SQL. We are also excluding fields from the checksum generation which does not have a direct impact on the DB, such as dbms, path, comments, etc. Besides it has an impact on the DB, we have decided to do not add replaceIfExists as part of this list of fields as we are already avoiding the recalculation of the checksum by listing the main content fields of the different change types.

Annotations
@Override
getPathback to summary
public String getPath()
Annotations
@DatabaseChangeProperty
description:File containing the procedure text. You must either use this attribute or write inline SQL within the createProcedure definition.
exampleValue:com/example/my-logic.sql
getProcedureBodyback to summary
public String getProcedureBody()
Annotations
@DatabaseChangeProperties:@liquibase.change.DatabaseChangeProperty(serializationType=DIRECT_VALUE, version={V8}), @liquibase.change.DatabaseChangeProperty(isChangeProperty=false)
getProcedureNameback to summary
public String getProcedureName()
Annotations
@DatabaseChangeProperty
exampleValue:new_customer
description:Name of the stored procedure to create. Required if replaceIfExists=true
getProcedureTextback to summary
public String getProcedureText()
Annotations
@DatabaseChangeProperties:@liquibase.change.DatabaseChangeProperty(description="The SQL creating the procedure. You need to define either this attribute or \'path\'. procedureText is not supported in the XML format; however, you can specify the procedure SQL inline within the createProcedure definition.", isChangeProperty=false, version={V8}), @liquibase.change.DatabaseChangeProperty(description="The SQL creating the procedure. You need to define either this attribute or \'path\'. procedureText is not supported in the XML format; however, you can specify the procedure SQL inline within the createProcedure definition.", serializationType=DIRECT_VALUE)
getReplaceIfExistsback to summary
public Boolean getReplaceIfExists()
Annotations
@DatabaseChangeProperty
description:If the stored procedure defined by createProcedure already exists, alter it instead of creating it. Default: false
getSchemaNameback to summary
public String getSchemaName()
Annotations
@DatabaseChangeProperty
description:Name of the database schema
getSerializedObjectNamespaceback to summary
public String getSerializedObjectNamespace()

Overrides liquibase.change.AbstractChange.getSerializedObjectNamespace.

Implements liquibase.serializer.LiquibaseSerializable.getSerializedObjectNamespace.

Annotations
@Override
isRelativeToChangelogFileback to summary
public Boolean isRelativeToChangelogFile()
Annotations
@DatabaseChangeProperty
description:Specifies whether the file path is relative to the changelog file rather than looked up in the search path. Default: false.
openSqlStreamback to summary
public InputStream openSqlStream() throws IOException
setCatalogNameback to summary
public void setCatalogName(String catalogName)
setCommentsback to summary
public void setComments(String comments)
setDbmsback to summary
public void setDbms(final String dbms)

Implements liquibase.change.DbmsTargetedChange.setDbms.

Annotations
@Override
setEncodingback to summary
public void setEncoding(String encoding)
setPathback to summary
public void setPath(String path)
setProcedureBodyback to summary
public void setProcedureBody(String procedureText)

Deprecated

Use setProcedureText() instead

Annotations
@Deprecated
setProcedureNameback to summary
public void setProcedureName(String procedureName)
setProcedureTextback to summary
public void setProcedureText(String procedureText)
setRelativeToChangelogFileback to summary
public void setRelativeToChangelogFile(Boolean relativeToChangelogFile)
setReplaceIfExistsback to summary
public void setReplaceIfExists(Boolean replaceIfExists)

Implements liquibase.change.ReplaceIfExists.setReplaceIfExists.

Annotations
@Override
setSchemaNameback to summary
public void setSchemaName(String schemaName)
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