Top Inners Fields Constructors Methods
liquibase.diff.output.changelog

public Class DiffToChangeLog

extends Object
Class Inheritance
Imports
liquibase.GlobalConfiguration, .Labels, .Scope, liquibase.change.Change, .ReplaceIfExists, liquibase.change.core.*, liquibase.changelog.ChangeSet, liquibase.changeset.ChangeSetService, .ChangeSetServiceFactory, liquibase.command.CommandScope, liquibase.command.core.GenerateChangelogCommandStep, liquibase.configuration.core.DeprecatedConfigurationValueProvider, liquibase.database.*, liquibase.database.core.*, liquibase.diff.DiffResult, .ObjectDifferences, liquibase.diff.compare.CompareControl, .DatabaseObjectCollectionComparator, liquibase.diff.output.DiffOutputControl, liquibase.exception.DatabaseException, .UnexpectedLiquibaseException, liquibase.executor.Executor, .ExecutorService, liquibase.resource.OpenOptions, .PathHandlerFactory, .Resource, liquibase.serializer.ChangeLogSerializer, .ChangeLogSerializerFactory, liquibase.snapshot.DatabaseSnapshot, .EmptyDatabaseSnapshot, liquibase.statement.core.RawParameterizedSqlStatement, .RawSqlStatement, liquibase.structure.DatabaseObject, liquibase.structure.core.Column, .StoredDatabaseLogic, .StoredProcedure, .View, liquibase.util.DependencyUtil, .StreamUtil, .StringUtil, javax.xml.parsers.ParserConfigurationException, java.io.ByteArrayOutputStream, .IOException, .OutputStream, .PrintStream, java.text.SimpleDateFormat, java.util.*, java.util.stream.Collectors

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private int
private String[]
private String
private String
private String
private String
private String[]
public static final String
public static final String
public static final String
private final DiffOutputControl
private DiffResult
public static final String
private String
private static final Set<Class<T>>
public static final String
private boolean
private boolean

Constructor Summary

AccessConstructor and Description
public
DiffToChangeLog(DiffResult diffResult, DiffOutputControl diffOutputControl)

public

Method Summary

Modifier and TypeMethod and Description
protected void
addDependencies(DependencyUtil.DependencyGraph<String> graph, List<String> schemas, Database database)

Adds dependencies to the graph as schema.object_name.

private void
addToChangeSets(Change[] changes, List<ChangeSet> changeSets, ObjectQuotingStrategy quotingStrategy, String created)

private List<ChangeSet>
private Database
public List<ChangeSet>
protected String
generateId(Change[] changes)

protected String[]
protected String
public String
protected String[]
private DatabaseObjectCollectionComparator
protected List<Class<? extends DatabaseObject>>
getOrderedOutputTypes(Class<? extends ChangeGenerator> generatorType)

private boolean
private boolean
public void
printNew(ChangeLogSerializer changeLogSerializer, Resource file)

Prints changeLog that would bring the target database to be the same as the reference database

private List<Map<String, ?>>
private String
private void
public void
setChangeReplaceIfExistsTypes(final String[] replaceIfExistsTypes)

public void
setChangeSetAuthor(String changeSetAuthor)

public void
setChangeSetContext(String changeSetContext)

public void
setChangeSetLabels(String changeSetLabels)

public void
setChangeSetPath(String changeSetPath)

public void
setChangeSetRunOnChangeTypes(final String[] runOnChangeTypes)

public void
public void
setIdRoot(String idRoot)

private void
private List<DatabaseObject>
private List<DatabaseObject>
sortObjects(final String type, Collection<DatabaseObject> objects, Database database)

private List<DatabaseObject>
sortUnexpectedObjects(Collection<? extends DatabaseObject> unexpectedObjects, Database database)

protected boolean
supportsSortingObjects(Database database)

Used by sortMissingObjects(Collection, Database) to determine whether to go into the sorting logic.

protected boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

changeNumberback to summary
private int changeNumber
changeReplaceIfExistsTypesback to summary
private String[] changeReplaceIfExistsTypes
changeSetAuthorback to summary
private String changeSetAuthor
changeSetContextback to summary
private String changeSetContext
changeSetLabelsback to summary
private String changeSetLabels
changeSetPathback to summary
private String changeSetPath
changeSetRunOnChangeTypesback to summary
private String[] changeSetRunOnChangeTypes
DATABASE_CHANGE_LOG_CLOSING_XML_TAGback to summary
public static final String DATABASE_CHANGE_LOG_CLOSING_XML_TAG
DIFF_OUTPUT_CONTROL_SCOPE_KEYback to summary
public static final String DIFF_OUTPUT_CONTROL_SCOPE_KEY
DIFF_SNAPSHOT_DATABASEback to summary
public static final String DIFF_SNAPSHOT_DATABASE
diffOutputControlback to summary
private final DiffOutputControl diffOutputControl
diffResultback to summary
private DiffResult diffResult
EXTERNAL_FILE_DIR_SCOPE_KEYback to summary
public static final String EXTERNAL_FILE_DIR_SCOPE_KEY
idRootback to summary
private String idRoot
loggedOrderForback to summary
private static final Set<Class<T>> loggedOrderFor
ORDER_ATTRIBUTEback to summary
public static final String ORDER_ATTRIBUTE
overriddenIdRootback to summary
private boolean overriddenIdRoot
tryDbaDependenciesback to summary
private boolean tryDbaDependencies

Constructor Detail

DiffToChangeLogback to summary
public DiffToChangeLog(DiffResult diffResult, DiffOutputControl diffOutputControl)
DiffToChangeLogback to summary
public DiffToChangeLog(DiffOutputControl diffOutputControl)

Method Detail

addDependenciesback to summary
protected void addDependencies(DependencyUtil.DependencyGraph<String> graph, List<String> schemas, Database database) throws DatabaseException

Adds dependencies to the graph as schema.object_name.

addToChangeSetsback to summary
private void addToChangeSets(Change[] changes, List<ChangeSet> changeSets, ObjectQuotingStrategy quotingStrategy, String created)
bringDropFKToTopback to summary
private List<ChangeSet> bringDropFKToTop(List<ChangeSet> changeSets)
determineDatabaseback to summary
private Database determineDatabase(DatabaseSnapshot snapshot)
generateChangeSetsback to summary
public List<ChangeSet> generateChangeSets()
generateIdback to summary
protected String generateId(Change[] changes)
getChangeReplaceIfExistsTypesback to summary
protected String[] getChangeReplaceIfExistsTypes()
getChangeSetAuthorback to summary
protected String getChangeSetAuthor()
getChangeSetPathback to summary
public String getChangeSetPath()
getChangeSetRunOnChangeTypesback to summary
protected String[] getChangeSetRunOnChangeTypes()
getDatabaseObjectCollectionComparatorback to summary
private DatabaseObjectCollectionComparator getDatabaseObjectCollectionComparator()
getOrderedOutputTypesback to summary
protected List<Class<? extends DatabaseObject>> getOrderedOutputTypes(Class<? extends ChangeGenerator> generatorType)
isContainedInReplaceIfExistsTypesback to summary
private boolean isContainedInReplaceIfExistsTypes(final Change change)
isContainedInRunOnChangeTypesback to summary
private boolean isContainedInRunOnChangeTypes(final Change change)
printNewback to summary
public void printNew(ChangeLogSerializer changeLogSerializer, Resource file) throws ParserConfigurationException, IOException, DatabaseException

Prints changeLog that would bring the target database to be the same as the reference database

queryForDependenciesOracleback to summary
private List<Map<String, ?>> queryForDependenciesOracle(Executor executor, List<String> schemas) throws DatabaseException
queryForDependenciesPostgreSqlback to summary
private String queryForDependenciesPostgreSql(List<String> schemas)
respectSchemaAndCatalogCaseIfNeededback to summary
private void respectSchemaAndCatalogCaseIfNeeded(DiffOutputControl diffOutputControl)
setChangeReplaceIfExistsTypesback to summary
public void setChangeReplaceIfExistsTypes(final String[] replaceIfExistsTypes)
setChangeSetAuthorback to summary
public void setChangeSetAuthor(String changeSetAuthor)
setChangeSetContextback to summary
public void setChangeSetContext(String changeSetContext)
setChangeSetLabelsback to summary
public void setChangeSetLabels(String changeSetLabels)
setChangeSetPathback to summary
public void setChangeSetPath(String changeSetPath)
setChangeSetRunOnChangeTypesback to summary
public void setChangeSetRunOnChangeTypes(final String[] runOnChangeTypes)
setDiffResultback to summary
public void setDiffResult(DiffResult diffResult)
setIdRootback to summary
public void setIdRoot(String idRoot)
setReplaceIfExistsTrueIfApplicableback to summary
private void setReplaceIfExistsTrueIfApplicable(Change[] changes)
sortMissingObjectsback to summary
private List<DatabaseObject> sortMissingObjects(Collection<DatabaseObject> missingObjects, Database database)
sortObjectsback to summary
private List<DatabaseObject> sortObjects(final String type, Collection<DatabaseObject> objects, Database database)
sortUnexpectedObjectsback to summary
private List<DatabaseObject> sortUnexpectedObjects(Collection<? extends DatabaseObject> unexpectedObjects, Database database)
supportsSortingObjectsback to summary
protected boolean supportsSortingObjects(Database database)

Used by sortMissingObjects(Collection, Database) to determine whether to go into the sorting logic.

useSeparateChangeSetsback to summary
protected boolean useSeparateChangeSets(Change[] changes)
liquibase.diff.output.changelog back to summary

private Class DiffToChangeLog.DependencyGraph

extends Object
Class Inheritance
  • java.lang.Object
  • liquibase.diff.output.changelog.DiffToChangeLog.DependencyGraph

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final Map<Class<? extends DatabaseObject>, DiffToChangeLog.DependencyGraph.Node>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
addType(Class<? extends DatabaseObject> type)

private void
private DiffToChangeLog.DependencyGraph.Node
getNode(Class<? extends DatabaseObject> type)

private DiffToChangeLog.DependencyGraph.Node
public List<Class<? extends DatabaseObject>>
sort(Database database, Class<? extends ChangeGenerator> generatorType)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

allNodesback to summary
private final Map<Class<? extends DatabaseObject>, DiffToChangeLog.DependencyGraph.Node> allNodes

Constructor Detail

DependencyGraphback to summary
private DependencyGraph()

Method Detail

addTypeback to summary
private void addType(Class<? extends DatabaseObject> type)
checkForCycleInDependenciesback to summary
private void checkForCycleInDependencies(Class<? extends ChangeGenerator> generatorType)
getNodeback to summary
private DiffToChangeLog.DependencyGraph.Node getNode(Class<? extends DatabaseObject> type)
retrieveOrCreateNodeback to summary
private DiffToChangeLog.DependencyGraph.Node retrieveOrCreateNode(Map<Class<? extends DatabaseObject>, DiffToChangeLog.DependencyGraph.Node> newNodes, Class<? extends DatabaseObject> type)
sortback to summary
public List<Class<? extends DatabaseObject>> sort(Database database, Class<? extends ChangeGenerator> generatorType)
liquibase.diff.output.changelog back to summary

pack-priv Class DiffToChangeLog.DependencyGraph.Edge

extends Object
Class Inheritance
  • java.lang.Object
  • liquibase.diff.output.changelog.DiffToChangeLog.DependencyGraph.Edge

Field Summary

Modifier and TypeField and Description
public final DiffToChangeLog.DependencyGraph.Node
public final DiffToChangeLog.DependencyGraph.Node

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
liquibase.diff.output.changelog back to summary

pack-priv Class DiffToChangeLog.DependencyGraph.Node

extends Object
Class Inheritance
  • java.lang.Object
  • liquibase.diff.output.changelog.DiffToChangeLog.DependencyGraph.Node

Field Summary

Modifier and TypeField and Description
public final HashSet<DiffToChangeLog.DependencyGraph.Edge>
public final HashSet<DiffToChangeLog.DependencyGraph.Edge>
public final Class<? extends DatabaseObject>

Constructor Summary

AccessConstructor and Description
public
Node(Class<? extends DatabaseObject> type)

Method Summary

Modifier and TypeMethod and Description
public DiffToChangeLog.DependencyGraph.Node
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

inEdgesback to summary
public final HashSet<DiffToChangeLog.DependencyGraph.Edge> inEdges
outEdgesback to summary
public final HashSet<DiffToChangeLog.DependencyGraph.Edge> outEdges
typeback to summary
public final Class<? extends DatabaseObject> type

Constructor Detail

Nodeback to summary
public Node(Class<? extends DatabaseObject> type)

Method Detail

addEdgeback to summary
public DiffToChangeLog.DependencyGraph.Node addEdge(DiffToChangeLog.DependencyGraph.Node node)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override