zongle compares the schema of two PostgreSQL databases and creates a script containing the SQL statements necessary to migrate the structure of the second database to the state of the first.
zongle is one-way: it compares the schema of a primary database to the schema of a secondary database and creates SQL statements accordingly. It does not check whether there are any additional tables/columns/other items in the secondary database.
Currently the comparison between two live databases is supported. The comparison between two scripts (as from pg_dump) or between a script and a live database will be supported in an upcoming release.
The current release 0.1.1 still lacks support for triggers and schema names, but nonetheless you might like to give it a whirl and drop me a line if you find it useful.
zongle is written in PHP CLI (no webserver required) and makes use of the Pear packages DB and Console_Getopt. It is developed under Debian GNU/Linux but any platform running PHP CLI, Pear::DB, Pear::Console_Getopt and PostgreSQL should be supported.
- command line tool
- compares tables and columns, views, sequences, constraints, functions (triggers in the work)
- non destructive (adds missing columns to tables, but will not change column types, or drop columns) - this does not mean you should not backup your database before applying a script generated by zongle
- platform independent
This is a bugfix release: PostgreSQL does not allow to add NOT NULL columns when doing an ALTER TABLE. Thanks to Tim Wasson for pointing this out and sending a patch. Also, non-NULL default values are now set correctly.
Possible long term goals
Being written in PHP, various front-ends can be plugged onto zongle, as a web-based or a Gtk one (PHP-GTK). Such a front-end could visually show the differences between the structures of the databases and allow users to manually select which changes to apply and which not.
In the past I have run across two similar projects, both named pgdiff.