Gentoo Archives: gentoo-user

From: Benjamin Blazke <ben_blazke@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] [OT] Looking for a tool to produce 'reverse' SQL
Date: Thu, 15 Jun 2006 18:25:30
Message-Id: 20060615181537.44942.qmail@web53208.mail.yahoo.com
1 Hi,
2
3 I'm looking for a tool that given an existing (base)
4 database schema and an 'update patch' DDL .sql script
5 on input would produce a 'reverse' script that could
6 be used to undo the changes done by the patch. For
7 example:
8
9 base.sql:
10 CREATE TABLE xxx (...);
11
12 patch.sql:
13 CREATE TABLE yyy (...);
14 ALTER TABLE xxx ADD COLUMN aaa ...;
15 ALTER TABLE xxx CHANGE column bbb ...
16
17 reverse.sql:
18 DROP TABLE yyy;
19 ALTER TABLE xxx DROP column aaa;
20 ALTER TABLE xxx CHANGE column bbb <get this from the
21 original base schema>
22
23 The purpose of this exercise is to have a production
24 database (MySQL) server that needs to update its
25 schema once in a while to reflect the changes in the
26 related application without the need to recreate the
27 schema from scratch (and possibly losing data). The
28 reverse.sql script could be later used to rollback the
29 schema changes at any time, even rollback multiple
30 patches.
31
32 How do people generally solve this? I'm sure this must
33 be a fairly common problem.
34
35 Thanks.
36
37 Ben
38
39
40
41 __________________________________________________
42 Do You Yahoo!?
43 Tired of spam? Yahoo! Mail has the best spam protection around
44 http://mail.yahoo.com
45 --
46 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] [OT] Looking for a tool to produce 'reverse' SQL kashani <kashani-list@××××××××.net>
Re: [gentoo-user] [OT] Looking for a tool to produce 'reverse' SQL Daniel Iliev <danny@××××××××.com>