Hi, I'm looking for a tool that given an existing (base) database schema and an 'update patch' DDL .sql script on input would produce a 'reverse' script that could be used to undo the changes done by the patch. For example:
base.sql: CREATE TABLE xxx (...); patch.sql: CREATE TABLE yyy (...); ALTER TABLE xxx ADD COLUMN aaa ...; ALTER TABLE xxx CHANGE column bbb ... reverse.sql: DROP TABLE yyy; ALTER TABLE xxx DROP column aaa; ALTER TABLE xxx CHANGE column bbb <get this from the original base schema> The purpose of this exercise is to have a production database (MySQL) server that needs to update its schema once in a while to reflect the changes in the related application without the need to recreate the schema from scratch (and possibly losing data). The reverse.sql script could be later used to rollback the schema changes at any time, even rollback multiple patches. How do people generally solve this? I'm sure this must be a fairly common problem. Thanks. Ben __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- gentoo-user@gentoo.org mailing list