I hope it helps you so I use it I leave you an example
database structure in production:
pg_dump --host localhost --port 5432 -U postgres --format plain --schema-only -f tmp/productionv1.sql dell
developing database structure:
pg_dump --host localhost --port 5432 -U postgres --format plain --schema-only -f tmp/developer2.sql dell
Once you have the exported databases, apgdiff is told to detect the changes made to apply them in production, example:
java -jar apgdiff-2.4.jar productionv1.sql developer2.sql > cambios.sql
As you know apgdiff is done in java once you execute it you would have the file changes.sql with the changes where it would only be adding them wherever you want