dbTuning: Schema Diff

A php script for visually diffing two schema dumps

Created by: spiderr, Last modification: 26 May 2005 (18:28 UTC)
Attached to this wiki page is a php script I smacked together a few months back when I needed to do visually diff two versions of a schema to see what columns, tables, indices, etc had changed. This made the task of writing an upgrade script to get the outdated schema compatible with the new schema much easier. This was specifically written to handle the output of postgresql's pg_dump utility (using the --schema_only switch) so your milage may vary when using other databases.

It can be used as either a command line tool by passing in the path to the sql files containing the schema info or it can be used as a page served by a webserver by appending two get variables to the URL. For example let's say I have this script being hosted on my local webserver:

http:://localhost/schema_diff.php?schemaA=/tmp/oldschema.sql&schemaB=/tmp/newschema.sql

that will display the comparision of the two schemas in your web browser. When using this tool from the command line you will probably want to redirect the output to a file since the output is in HTML.