Class PgDiff

java.lang.Object
org.pgcodekeeper.core.PgDiff

public class PgDiff extends Object
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 Details

    • PgDiff

      public PgDiff(ISettings settings)
      Creates a new PgDiff instance with the specified settings.
      Parameters:
      settings - the configuration settings for the diff operation
  • Method Details

    • getErrors

      public List<Object> getErrors()
    • diff

      public String diff(TreeElement root, AbstractDatabase oldDb, AbstractDatabase newDb, List<Map.Entry<PgStatement,PgStatement>> additionalDependenciesOldDb, List<Map.Entry<PgStatement,PgStatement>> additionalDependenciesNewDb, IgnoreList ignoreList) throws IOException
      Gets selected elements from root, compares them between source and target and generates a migration script.
      Parameters:
      root - the root of the diff tree
      oldDb - the source database schema
      newDb - the target database schema
      additionalDependenciesOldDb - additional dependencies in old database
      additionalDependenciesNewDb - additional dependencies in new database
      ignoreList - list of objects to ignore during comparison
      Returns:
      SQL migration script
      Throws:
      IOException - if an I/O error occurs