Package liquibase.changelog
Class DatabaseChangeLog
java.lang.Object
liquibase.changelog.DatabaseChangeLog
- All Implemented Interfaces:
Comparable<DatabaseChangeLog>,Conditional
Encapsulates the information stored in the change log XML file.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumControls what to do when including a file with a format that isn't recognized by a changelog parser. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChangeSet(ChangeSet changeSet) voidintprotected ChangeSetcreateChangeSet(ParsedNode node, ResourceAccessor resourceAccessor) static StringReturns a human-readable description of the external-path form detected inpath, ornullif the path does not match any external pattern thatrequireRelativeChangelogPathOrThrow(String, boolean, String)would reject.determineResourceComparator(String resourceComparatorDef) booleanprotected voidexpandExpressions(ParsedNode parsedNode) findResources(String pathName, boolean isRelativeToChangelogFile, IncludeAllFilter resourceFilter, boolean errorIfMissingOrEmpty, Comparator<String> resourceComparator, ResourceAccessor resourceAccessor, int minDepth, int maxDepth) Deprecated.findResources(String pathName, boolean isRelativeToChangelogFile, IncludeAllFilter resourceFilter, boolean errorIfMissingOrEmpty, Comparator<String> resourceComparator, ResourceAccessor resourceAccessor, int minDepth, int maxDepth, String endsWithFilter) getChangeSet(String path, String author, String id) getChangeSet(RanChangeSet ranChangeSet) getChangeSets(String path, String author, String id) getChangeSets(RanChangeSet ranChangeSet) Deprecated.useinvalid reference
#getContextFilter()protected Comparator<String> protected voidhandleChildNode(ParsedNode node, ResourceAccessor resourceAccessor) protected voidhandleChildNode(ParsedNode node, ResourceAccessor resourceAccessor, Map<String, Object> nodeScratch) voidhandleChildNodeHelper(ParsedNode node, ResourceAccessor resourceAccessor, Map<String, Object> nodeScratch) inthashCode()booleaninclude(String fileName, boolean isRelativePath, boolean errorIfMissing, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, LabelExpression labelExpression, Boolean ignore, boolean logEveryUnknownFileFormat) booleaninclude(String fileName, boolean isRelativePath, boolean errorIfMissing, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, Boolean ignore, boolean logEveryUnknownFileFormat) booleaninclude(String fileName, boolean isRelativePath, boolean errorIfMissing, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, Boolean ignore, String logicalFilePath, DatabaseChangeLog.OnUnknownFileFormat onUnknownFileFormat) booleaninclude(String fileName, boolean isRelativePath, boolean errorIfMissing, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, Boolean ignore, String logicalFilePath, DatabaseChangeLog.OnUnknownFileFormat onUnknownFileFormat, ModifyChangeSets modifyChangeSets) booleaninclude(String fileName, boolean isRelativePath, boolean errorIfMissing, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, Boolean ignore, DatabaseChangeLog.OnUnknownFileFormat onUnknownFileFormat) voidincludeAll(String pathName, boolean isRelativeToChangelogFile, IncludeAllFilter resourceFilter, boolean errorIfMissingOrEmpty, Comparator<String> resourceComparator, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, LabelExpression labelExpression, boolean ignore) voidincludeAll(String pathName, boolean isRelativeToChangelogFile, IncludeAllFilter resourceFilter, boolean errorIfMissingOrEmpty, Comparator<String> resourceComparator, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, boolean ignore, int minDepth, int maxDepth, ModifyChangeSets modifyChangeSets) Deprecated.voidincludeAll(String pathName, boolean isRelativeToChangelogFile, IncludeAllFilter resourceFilter, boolean errorIfMissingOrEmpty, Comparator<String> resourceComparator, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, boolean ignore, String logicalFilePath, int minDepth, int maxDepth) voidincludeAll(String pathName, boolean isRelativeToChangelogFile, IncludeAllFilter resourceFilter, boolean errorIfMissingOrEmpty, Comparator<String> resourceComparator, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, boolean ignore, String logicalFilePath, int minDepth, int maxDepth, String endsWithFilter, ModifyChangeSets modifyChangeSets) booleanisDbmsMatch(String dbmsList) booleanisDbmsMatch(Set<String> dbmsSet) voidload(ParsedNode parsedNode, ResourceAccessor resourceAccessor) static StringnormalizePath(String filePath) static voidrequireRelativeChangelogPathOrThrow(String path, boolean relativeToChangelogFile, String elementName) Defence-in-depth gate for<include>,<includeAll>, and<sqlFile>path resolution whenGlobalConfiguration.ALLOW_EXTERNAL_CHANGELOG_PATHShas been set tofalse.voidsetChangeLogParameters(ChangeLogParameters changeLogParameters) voidsetContextFilter(ContextExpression contextFilter) voidsetContexts(ContextExpression contexts) Deprecated.voidsetIncludeContextFilter(ContextExpression includeContextFilter) voidsetIncludeContexts(ContextExpression includeContexts) Deprecated.voidsetIncludeIgnore(boolean ignore) voidsetIncludeLabels(LabelExpression labels) Deprecated.Correct version issetIncludeLabels(Labels).voidsetIncludeLabels(Labels labels) voidsetLogicalFilePath(String logicalFilePath) voidsetObjectQuotingStrategy(ObjectQuotingStrategy objectQuotingStrategy) voidsetParentChangeLog(DatabaseChangeLog parentChangeLog) voidsetPhysicalFilePath(String physicalFilePath) voidsetPreconditions(PreconditionContainer precondition) voidsetRootChangeLog(DatabaseChangeLog rootChangeLog) voidsetRuntimeEnvironment(RuntimeEnvironment runtimeEnvironment) toString()voidvoidvalidate(Database database, Contexts contexts, LabelExpression labelExpression)
-
Field Details
-
SEEN_CHANGELOGS_PATHS_SCOPE_KEY
- See Also:
-
FILE
- See Also:
-
CONTEXT_FILTER
- See Also:
-
CONTEXT
- See Also:
-
LABELS
- See Also:
-
IGNORE
- See Also:
-
RELATIVE_TO_CHANGELOG_FILE
- See Also:
-
LOGICAL_FILE_PATH
- See Also:
-
ERROR_IF_MISSING
- See Also:
-
MODIFY_CHANGE_SETS
- See Also:
-
PATH
- See Also:
-
FILTER
- See Also:
-
RESOURCE_FILTER
- See Also:
-
RESOURCE_COMPARATOR
- See Also:
-
MIN_DEPTH
- See Also:
-
MAX_DEPTH
- See Also:
-
ENDS_WITH_FILTER
- See Also:
-
ERROR_IF_MISSING_OR_EMPTY
- See Also:
-
CHANGE_SET
- See Also:
-
DBMS
- See Also:
-
INCLUDE_CHANGELOG
- See Also:
-
INCLUDE_ALL_CHANGELOGS
- See Also:
-
PRE_CONDITIONS
- See Also:
-
REMOVE_CHANGE_SET_PROPERTY
- See Also:
-
PROPERTY
- See Also:
-
NAME
- See Also:
-
VALUE
- See Also:
-
GLOBAL
- See Also:
-
-
Constructor Details
-
DatabaseChangeLog
public DatabaseChangeLog() -
DatabaseChangeLog
-
-
Method Details
-
setRootChangeLog
-
getRootChangeLog
-
setParentChangeLog
-
setRuntimeEnvironment
-
getPreconditions
- Specified by:
getPreconditionsin interfaceConditional
-
setPreconditions
- Specified by:
setPreconditionsin interfaceConditional
-
setChangeLogParameters
-
setPhysicalFilePath
-
getRawLogicalFilePath
-
getLogicalFilePath
-
setLogicalFilePath
-
getFilePath
-
setObjectQuotingStrategy
-
getContexts
Deprecated.useinvalid reference
#getContextFilter() -
setContexts
Deprecated. -
setContextFilter
-
setIncludeLabels
Deprecated.Correct version issetIncludeLabels(Labels). Kept for backwards compatibility. -
setIncludeLabels
-
setIncludeIgnore
public void setIncludeIgnore(boolean ignore) -
setIncludeContexts
Deprecated. -
setIncludeContextFilter
-
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<DatabaseChangeLog>
-
getChangeSet
-
getChangeSets
-
addChangeSet
-
equals
-
hashCode
public int hashCode() -
validate
- Throws:
LiquibaseException
-
validate
public void validate(Database database, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException - Throws:
LiquibaseException
-
getChangeSet
-
getChangeSets
-
load
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException, SetupException - Throws:
ParsedNodeExceptionSetupException
-
expandExpressions
-
handleChildNode
protected void handleChildNode(ParsedNode node, ResourceAccessor resourceAccessor) throws ParsedNodeException, SetupException - Throws:
ParsedNodeExceptionSetupException
-
handleChildNode
protected void handleChildNode(ParsedNode node, ResourceAccessor resourceAccessor, Map<String, Object> nodeScratch) throws ParsedNodeException, SetupException- Throws:
ParsedNodeExceptionSetupException
-
handleChildNodeHelper
public void handleChildNodeHelper(ParsedNode node, ResourceAccessor resourceAccessor, Map<String, Object> nodeScratch) throws ParsedNodeException, SetupException- Throws:
ParsedNodeExceptionSetupException
-
determineResourceComparator
-
isDbmsMatch
-
isDbmsMatch
-
includeAll
@Deprecated public void includeAll(String pathName, boolean isRelativeToChangelogFile, IncludeAllFilter resourceFilter, boolean errorIfMissingOrEmpty, Comparator<String> resourceComparator, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, LabelExpression labelExpression, boolean ignore) throws SetupException Deprecated.- Throws:
SetupException
-
includeAll
public void includeAll(String pathName, boolean isRelativeToChangelogFile, IncludeAllFilter resourceFilter, boolean errorIfMissingOrEmpty, Comparator<String> resourceComparator, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, boolean ignore, String logicalFilePath, int minDepth, int maxDepth) throws SetupException - Throws:
SetupException
-
includeAll
@Deprecated public void includeAll(String pathName, boolean isRelativeToChangelogFile, IncludeAllFilter resourceFilter, boolean errorIfMissingOrEmpty, Comparator<String> resourceComparator, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, boolean ignore, int minDepth, int maxDepth, ModifyChangeSets modifyChangeSets) throws SetupException Deprecated.- Throws:
SetupException
-
includeAll
public void includeAll(String pathName, boolean isRelativeToChangelogFile, IncludeAllFilter resourceFilter, boolean errorIfMissingOrEmpty, Comparator<String> resourceComparator, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, boolean ignore, String logicalFilePath, int minDepth, int maxDepth, String endsWithFilter, ModifyChangeSets modifyChangeSets) throws SetupException - Throws:
SetupException
-
findResources
@Deprecated public SortedSet<Resource> findResources(String pathName, boolean isRelativeToChangelogFile, IncludeAllFilter resourceFilter, boolean errorIfMissingOrEmpty, Comparator<String> resourceComparator, ResourceAccessor resourceAccessor, int minDepth, int maxDepth) throws SetupException Deprecated.- Throws:
SetupException
-
findResources
public SortedSet<Resource> findResources(String pathName, boolean isRelativeToChangelogFile, IncludeAllFilter resourceFilter, boolean errorIfMissingOrEmpty, Comparator<String> resourceComparator, ResourceAccessor resourceAccessor, int minDepth, int maxDepth, String endsWithFilter) throws SetupException - Throws:
SetupException
-
include
@Deprecated public boolean include(String fileName, boolean isRelativePath, boolean errorIfMissing, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, LabelExpression labelExpression, Boolean ignore, boolean logEveryUnknownFileFormat) throws LiquibaseException Deprecated.- Throws:
LiquibaseException
-
include
@Deprecated public boolean include(String fileName, boolean isRelativePath, boolean errorIfMissing, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, Boolean ignore, boolean logEveryUnknownFileFormat) throws LiquibaseException Deprecated.- Throws:
LiquibaseException
-
include
public boolean include(String fileName, boolean isRelativePath, boolean errorIfMissing, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, Boolean ignore, DatabaseChangeLog.OnUnknownFileFormat onUnknownFileFormat) throws LiquibaseException Deprecated.- Throws:
LiquibaseException
-
include
public boolean include(String fileName, boolean isRelativePath, boolean errorIfMissing, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, Boolean ignore, String logicalFilePath, DatabaseChangeLog.OnUnknownFileFormat onUnknownFileFormat) throws LiquibaseException - Throws:
LiquibaseException
-
include
public boolean include(String fileName, boolean isRelativePath, boolean errorIfMissing, ResourceAccessor resourceAccessor, ContextExpression includeContextFilter, Labels labels, Boolean ignore, String logicalFilePath, DatabaseChangeLog.OnUnknownFileFormat onUnknownFileFormat, ModifyChangeSets modifyChangeSets) throws LiquibaseException - Throws:
LiquibaseException
-
createChangeSet
protected ChangeSet createChangeSet(ParsedNode node, ResourceAccessor resourceAccessor) throws ParsedNodeException - Throws:
ParsedNodeException
-
getStandardChangeLogComparator
-
requireRelativeChangelogPathOrThrow
public static void requireRelativeChangelogPathOrThrow(String path, boolean relativeToChangelogFile, String elementName) throws SetupException Defence-in-depth gate for<include>,<includeAll>, and<sqlFile>path resolution whenGlobalConfiguration.ALLOW_EXTERNAL_CHANGELOG_PATHShas been set tofalse. Rejects two path forms that escape the configured ResourceAccessor search-path scope:- The
classpath:URI prefix — reaches JAR resources or other classpath locations outside the search path. - Absolute filesystem paths (Unix
/..., UNC\\..., Windows drive-letterC:...) — reach arbitrary filesystem locations.
relativeToChangelogFile=truebecause the path is then resolved relative to the parent changelog file and cannot escape its directory. Bypassed when the flag istrue(the default — preserves Spring Bootclasspath:db/changelog/...patterns and other documented usage). See CWE-22.- Throws:
SetupException- with a message that names the flag in both directions and the specific pattern detected, so the operator can either remove the offending prefix, setrelativeToChangelogFile=true, or re-enable external paths.
- The
-
detectExternalChangelogPathForm
Returns a human-readable description of the external-path form detected inpath, ornullif the path does not match any external pattern thatrequireRelativeChangelogPathOrThrow(String, boolean, String)would reject. Public so callers (e.g. SQLFileChange.validate) can build context-appropriate error messages without re-implementing the detection. -
normalizePath
-
clearCheckSums
public void clearCheckSums()
-
include(String, boolean, boolean, ResourceAccessor, ContextExpression, Labels, Boolean, String, OnUnknownFileFormat)