Package liquibase.change.core
Class SQLFileChange
- java.lang.Object
-
- liquibase.AbstractExtensibleObject
-
- liquibase.plugin.AbstractPlugin
-
- liquibase.change.AbstractChange
-
- liquibase.change.AbstractSQLChange
-
- liquibase.change.core.SQLFileChange
-
- All Implemented Interfaces:
Cloneable
,Change
,DbmsTargetedChange
,ExtensibleObject
,Plugin
,LiquibaseSerializable
public class SQLFileChange extends AbstractSQLChange
Represents a Change for custom SQL stored in a File.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class liquibase.change.AbstractSQLChange
AbstractSQLChange.NormalizingStream
-
Nested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable
LiquibaseSerializable.SerializationType
-
-
Field Summary
-
Fields inherited from class liquibase.change.AbstractSQLChange
encoding
-
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
Constructors Constructor Description SQLFileChange()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
describe()
Output a full description of this object.void
finishInitialization()
Default implementation is a no-opCheckSum
generateCheckSum()
Calculates the checksum based on the contained SQL.boolean
generateRollbackStatementsVolatile(Database database)
Implementation delegates logic to theSqlGenerator.generateRollbackStatementsIsVolatile(Database)
method on theSqlStatement
objects returned byChange.generateStatements(liquibase.database.Database)
If no or null SqlStatements are returned by generateRollbackStatements then this method returns false.boolean
generateStatementsVolatile(Database database)
Implementation delegates logic to theSqlGenerator.generateStatementsIsVolatile(Database)
method on theSqlStatement
objects returned byChange.generateStatements(liquibase.database.Database)
.String
getConfirmationMessage()
Confirmation message to be displayed after the change is executed.String
getEncoding()
The encoding of the file containing SQL statementsString
getPath()
String
getSerializedObjectNamespace()
String
getSql()
Return the raw SQL managed by this ChangeBoolean
isRelativeToChangelogFile()
InputStream
openSqlStream()
void
setEncoding(String encoding)
void
setPath(String fileName)
Sets the file name but setUp must be called for the change to have impact.void
setRelativeToChangelogFile(Boolean relativeToChangelogFile)
void
setSql(String sql)
Set the raw SQL managed by this Change.ValidationErrors
validate(Database database)
Implementation checks the ChangeParameterMetaData for declared required fields and also delegates logic to theSqlGenerator.validate(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain)
method on theSqlStatement
objects returned byChange.generateStatements(liquibase.database.Database)
.-
Methods inherited from class liquibase.change.AbstractSQLChange
checkStatus, generateStatements, getDbms, getEndDelimiter, isIgnoreOriginalSplitStatements, isSplitStatements, isSplitStatementsSet, isStripComments, normalizeLineEndings, setDbms, setEndDelimiter, setIgnoreOriginalSplitStatements, setOriginalSplitStatements, setSplitStatements, setStripComments, supports, warn
-
Methods inherited from class liquibase.change.AbstractChange
createChangeMetaData, createChangeParameterMetadata, createDescriptionMetaData, createEmptyColumnConfig, createExampleValueMetaData, createInverses, createMustEqualExistingMetaData, createRequiredDatabasesMetaData, createSerializationTypeMetaData, createSinceMetaData, createSupportedDatabasesMetaData, customLoadLogic, equals, generateRollbackStatements, getAffectedDatabaseObjects, getChangeSet, getDescription, getExcludedFieldFilters, getResourceAccessor, getSerializableFieldNamespace, getSerializableFields, getSerializableFieldType, getSerializableFieldValue, getSerializedObjectName, hashCode, isInvalidProperty, load, modify, serialize, serializeValue, setChangeSet, setResourceAccessor, shouldExecuteChange, supportsRollback, toString
-
Methods inherited from class liquibase.AbstractExtensibleObject
clone, 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, get, get, getAttributes, getObjectMetaData, getValuePath, has, set
-
-
-
-
Method Detail
-
generateStatementsVolatile
public boolean generateStatementsVolatile(Database database)
Description copied from class:AbstractChange
Implementation delegates logic to theSqlGenerator.generateStatementsIsVolatile(Database)
method on theSqlStatement
objects returned byChange.generateStatements(liquibase.database.Database)
. If zero or null SqlStatements are returned by generateStatements then this method returns false.- Specified by:
generateStatementsVolatile
in interfaceChange
- Overrides:
generateStatementsVolatile
in classAbstractSQLChange
-
generateRollbackStatementsVolatile
public boolean generateRollbackStatementsVolatile(Database database)
Description copied from class:AbstractChange
Implementation delegates logic to theSqlGenerator.generateRollbackStatementsIsVolatile(Database)
method on theSqlStatement
objects returned byChange.generateStatements(liquibase.database.Database)
If no or null SqlStatements are returned by generateRollbackStatements then this method returns false.- Specified by:
generateRollbackStatementsVolatile
in interfaceChange
- Overrides:
generateRollbackStatementsVolatile
in classAbstractSQLChange
-
getPath
public String getPath()
-
setPath
public void setPath(String fileName)
Sets the file name but setUp must be called for the change to have impact.- Parameters:
fileName
- The file to use
-
getEncoding
public String getEncoding()
The encoding of the file containing SQL statements- Returns:
- the encoding
-
setEncoding
public void setEncoding(String encoding)
- Parameters:
encoding
- the encoding to set
-
isRelativeToChangelogFile
public Boolean isRelativeToChangelogFile()
-
setRelativeToChangelogFile
public void setRelativeToChangelogFile(Boolean relativeToChangelogFile)
-
finishInitialization
public void finishInitialization() throws SetupException
Description copied from class:AbstractChange
Default implementation is a no-op- Specified by:
finishInitialization
in interfaceChange
- Overrides:
finishInitialization
in classAbstractChange
- Throws:
SetupException
-
openSqlStream
public InputStream openSqlStream() throws IOException
- Overrides:
openSqlStream
in classAbstractSQLChange
- Throws:
IOException
-
validate
public ValidationErrors validate(Database database)
Description copied from class:AbstractChange
Implementation checks the ChangeParameterMetaData for declared required fields and also delegates logic to theSqlGenerator.validate(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain)
method on theSqlStatement
objects returned byChange.generateStatements(liquibase.database.Database)
. 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- Specified by:
validate
in interfaceChange
- Overrides:
validate
in classAbstractSQLChange
-
getConfirmationMessage
public String getConfirmationMessage()
Description copied from interface:Change
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.
-
getSql
public String getSql()
Description copied from class:AbstractSQLChange
Return the raw SQL managed by this Change- Overrides:
getSql
in classAbstractSQLChange
-
setSql
public void setSql(String sql)
Description copied from class:AbstractSQLChange
Set the raw SQL managed by this Change. The passed sql is trimmed and set to null if an empty string is passed.- Overrides:
setSql
in classAbstractSQLChange
-
getSerializedObjectNamespace
public String getSerializedObjectNamespace()
- Specified by:
getSerializedObjectNamespace
in interfaceLiquibaseSerializable
- Overrides:
getSerializedObjectNamespace
in classAbstractChange
-
describe
public String describe()
Description copied from interface:ExtensibleObject
Output a full description of this object. Should include all attributes and values.- Specified by:
describe
in interfaceExtensibleObject
- Overrides:
describe
in classAbstractExtensibleObject
-
generateCheckSum
public CheckSum generateCheckSum()
Description copied from class:AbstractSQLChange
Calculates the checksum based on the contained SQL.- Specified by:
generateCheckSum
in interfaceChange
- Overrides:
generateCheckSum
in classAbstractSQLChange
- See Also:
Change.generateCheckSum()
-
-