Class SimpleDepcyResolver
java.lang.Object
org.pgcodekeeper.core.model.graph.SimpleDepcyResolver
Simple dependency resolver for database objects.
Provides methods to find create and drop dependencies for database statements
using dependency graphs built from old and new database schemas.
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleDepcyResolver(AbstractDatabase oldDatabase, boolean isShowColumns) Creates a dependency resolver with old database only.SimpleDepcyResolver(AbstractDatabase oldDatabase, AbstractDatabase newDatabase, boolean isShowColumns) Creates a dependency resolver with both old and new database schemas. -
Method Summary
Modifier and TypeMethodDescriptiongetConnectedTo(PgStatement entity) Gets statements that the given entity is directly connected to.getCreateDepcies(PgStatement toCreate) Gets dependencies required for creating a statement.getDropDepcies(PgStatement toDrop) Gets dependencies that must be dropped when dropping a statement.
-
Constructor Details
-
SimpleDepcyResolver
Creates a dependency resolver with old database only.- Parameters:
oldDatabase- the old database schemaisShowColumns- whether to show column dependencies
-
SimpleDepcyResolver
public SimpleDepcyResolver(AbstractDatabase oldDatabase, AbstractDatabase newDatabase, boolean isShowColumns) Creates a dependency resolver with both old and new database schemas.- Parameters:
oldDatabase- the old database schemanewDatabase- the new database schema, can be nullisShowColumns- whether to show column dependencies
-
-
Method Details
-
getCreateDepcies
Gets dependencies required for creating a statement. Returns forward dependencies from the new database schema.- Parameters:
toCreate- the statement to create- Returns:
- collection of statements that must be created before the target statement
- Throws:
IllegalStateException- if new database is not defined
-
getDropDepcies
Gets dependencies that must be dropped when dropping a statement. Returns reverse dependencies from the old database schema.- Parameters:
toDrop- the statement to drop- Returns:
- collection of statements that depend on the target statement and must be dropped first
-
getConnectedTo
Gets statements that the given entity is directly connected to. Returns outgoing edges from the entity in the old database dependency graph.- Parameters:
entity- the statement to find connections for- Returns:
- set of statements that the entity depends on
-