CLI version

As an alternative for Eclipse IDE plug-in, it is possible to compare database schemas by using command line. To do this, you should download pgCodeKeeper-cli application, which works in stand-alone mode.

Console build of the program can be used for:

  • creating a pgCodeKeeper “project” from file structure dump (without Eclipse project)
  • creating migration scripts using pgCodeKeeper dumps and file strucutres
  • creating migration scripts using database connections
  • viewing the dependences of objects

Getting Started

First off, install Java SDK for your platform.

The latest version of cli build can be downloaded here. In the unpacked archive use files for parameter passing: pgcodekeeper-cli.sh for Linux systems and pgcodekeeper-cli.bat for Windows systems.

You can view the set of parameters available for work with the program by executing the command:

./pgcodekeeper-cli.sh --help

Examples

Writing migration script of the differences from the project of the test1 directory into the testdb1 database on the localhost:5432 server into the diff.sql file:

./pgcodekeeper-cli.sh -o /home/codekeeper/projects/diff.sql 'jdbc:postgresql://localhost:5432/testdb1?user=user&password=password' /home/codekeeper/projects/test1/

Entering migration script from the backup file in the project of the test1 directory into the console:

./pgcodekeeper-cli.sh /home/codekeeper/backup.sql /home/codekeeper/projects/test1/

Creation of the project in the test1 directory basing on the testdb1 database on the localhost:5432 server:

./pgcodekeeper-cli.sh --parse -o /home/codekeeper/projects/test1/ 'jdbc:postgresql://localhost:5432/testdb1?user=user&password=password'

Displaying the dependences tree of the testdb1 database on the localhost:5432 server:

./pgcodekeeper-cli.sh --graph 'jdbc:postgresql://localhost:5432/testdb1?user=user&password=password'

Displaying the tree of objects on which t1 and t2 objects depend in the testdb1 database on the localhost:5432 server:

./pgcodekeeper-cli.sh --graph --graph-reverse --graph-name t1 --graph-name t2 'jdbc:postgresql://localhost:5432/testdb1?user=user&password=password'

All parameters after -vmargs will be transferred to VM.

Usage with restrictions of the memory used:

./pgcodekeeper-cli.sh 1.sql 2.sql -vmargs -Xms256m -Xmx2g

The VM parameter ru.taximaxim.codekeeper.parser.poolsize allows specifying the number of parser threads:

./pgcodekeeper-cli.sh 1.sql 2.sql -vmargs -Dru.taximaxim.codekeeper.parser.poolsize=5