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 Stringdescribe()Output a full description of this object.voidfinishInitialization()Default implementation is a no-opCheckSumgenerateCheckSum()Calculates the checksum based on the contained SQL.booleangenerateRollbackStatementsVolatile(Database database)Implementation delegates logic to theSqlGenerator.generateRollbackStatementsIsVolatile(Database)method on theSqlStatementobjects returned byChange.generateStatements(liquibase.database.Database)If no or null SqlStatements are returned by generateRollbackStatements then this method returns false.booleangenerateStatementsVolatile(Database database)Implementation delegates logic to theSqlGenerator.generateStatementsIsVolatile(Database)method on theSqlStatementobjects returned byChange.generateStatements(liquibase.database.Database).StringgetConfirmationMessage()Confirmation message to be displayed after the change is executed.StringgetEncoding()The encoding of the file containing SQL statementsStringgetPath()StringgetSerializedObjectNamespace()StringgetSql()Return the raw SQL managed by this ChangeBooleanisRelativeToChangelogFile()InputStreamopenSqlStream()voidsetEncoding(String encoding)voidsetPath(String fileName)Sets the file name but setUp must be called for the change to have impact.voidsetRelativeToChangelogFile(Boolean relativeToChangelogFile)voidsetSql(String sql)Set the raw SQL managed by this Change.ValidationErrorsvalidate(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 theSqlStatementobjects returned byChange.generateStatements(liquibase.database.Database).-
Methods inherited from class liquibase.change.AbstractSQLChange
checkStatus, generateStatements, getDbms, getEndDelimiter, isSplitStatements, isSplitStatementsSet, isStripComments, normalizeLineEndings, setDbms, setEndDelimiter, 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, 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:AbstractChangeImplementation delegates logic to theSqlGenerator.generateStatementsIsVolatile(Database)method on theSqlStatementobjects returned byChange.generateStatements(liquibase.database.Database). If zero or null SqlStatements are returned by generateStatements then this method returns false.- Specified by:
generateStatementsVolatilein interfaceChange- Overrides:
generateStatementsVolatilein classAbstractSQLChange
-
generateRollbackStatementsVolatile
public boolean generateRollbackStatementsVolatile(Database database)
Description copied from class:AbstractChangeImplementation delegates logic to theSqlGenerator.generateRollbackStatementsIsVolatile(Database)method on theSqlStatementobjects returned byChange.generateStatements(liquibase.database.Database)If no or null SqlStatements are returned by generateRollbackStatements then this method returns false.- Specified by:
generateRollbackStatementsVolatilein interfaceChange- Overrides:
generateRollbackStatementsVolatilein 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 SetupExceptionDescription copied from class:AbstractChangeDefault implementation is a no-op- Specified by:
finishInitializationin interfaceChange- Overrides:
finishInitializationin classAbstractChange- Throws:
SetupException
-
openSqlStream
public InputStream openSqlStream() throws IOException
- Overrides:
openSqlStreamin classAbstractSQLChange- Throws:
IOException
-
validate
public ValidationErrors validate(Database database)
Description copied from class:AbstractChangeImplementation 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 theSqlStatementobjects 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:
validatein interfaceChange- Overrides:
validatein classAbstractSQLChange
-
getConfirmationMessage
public String getConfirmationMessage()
Description copied from interface:ChangeConfirmation 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:AbstractSQLChangeReturn the raw SQL managed by this Change- Overrides:
getSqlin classAbstractSQLChange
-
setSql
public void setSql(String sql)
Description copied from class:AbstractSQLChangeSet the raw SQL managed by this Change. The passed sql is trimmed and set to null if an empty string is passed.- Overrides:
setSqlin classAbstractSQLChange
-
getSerializedObjectNamespace
public String getSerializedObjectNamespace()
- Specified by:
getSerializedObjectNamespacein interfaceLiquibaseSerializable- Overrides:
getSerializedObjectNamespacein classAbstractChange
-
describe
public String describe()
Description copied from interface:ExtensibleObjectOutput a full description of this object. Should include all attributes and values.- Specified by:
describein interfaceExtensibleObject- Overrides:
describein classAbstractExtensibleObject
-
generateCheckSum
public CheckSum generateCheckSum()
Description copied from class:AbstractSQLChangeCalculates the checksum based on the contained SQL.- Specified by:
generateCheckSumin interfaceChange- Overrides:
generateCheckSumin classAbstractSQLChange- See Also:
Change.generateCheckSum()
-
-