Package org.pgcodekeeper.core
Class PgDiff
java.lang.Object
org.pgcodekeeper.core.PgDiff
Main class for generating SQL scripts that transform one database schema to another.
This class compares two database schemas (old and new) and generates the SQL statements needed to migrate from the old schema to the new one.
- Author:
- fordfrog
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondiff(TreeElement root, AbstractDatabase oldDb, AbstractDatabase newDb, List<Map.Entry<PgStatement, PgStatement>> additionalDependenciesOldDb, List<Map.Entry<PgStatement, PgStatement>> additionalDependenciesNewDb, IgnoreList ignoreList) Gets selected elements from root, compares them between source and target and generates a migration script.
-
Constructor Details
-
PgDiff
Creates a new PgDiff instance with the specified settings.- Parameters:
settings- the configuration settings for the diff operation
-
-
Method Details
-
getErrors
-
diff
public String diff(TreeElement root, AbstractDatabase oldDb, AbstractDatabase newDb, List<Map.Entry<PgStatement, PgStatement>> additionalDependenciesOldDb, List<Map.Entry<PgStatement, throws IOExceptionPgStatement>> additionalDependenciesNewDb, IgnoreList ignoreList) Gets selected elements from root, compares them between source and target and generates a migration script.- Parameters:
root- the root of the diff treeoldDb- the source database schemanewDb- the target database schemaadditionalDependenciesOldDb- additional dependencies in old databaseadditionalDependenciesNewDb- additional dependencies in new databaseignoreList- list of objects to ignore during comparison- Returns:
- SQL migration script
- Throws:
IOException- if an I/O error occurs
-