public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] [OT] Looking for a tool to produce 'reverse' SQL
@ 2006-06-15 18:15 Benjamin Blazke
  2006-06-15 18:55 ` kashani
  2006-06-17 20:31 ` Daniel Iliev
  0 siblings, 2 replies; 4+ messages in thread
From: Benjamin Blazke @ 2006-06-15 18:15 UTC (permalink / raw
  To: gentoo-user

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-06-17 20:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20060615205451.27681.qmail@web53204.mail.yahoo.com>
2006-06-15 21:16 ` [gentoo-user] [OT] Looking for a tool to produce 'reverse' SQL kashani
2006-06-15 18:15 Benjamin Blazke
2006-06-15 18:55 ` kashani
2006-06-17 20:31 ` Daniel Iliev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox