Subject | Re: How to downgrade as well as upgrade schema changes (a la Rails)? |
---|---|
Author | mlq97 |
Post date | 2008-10-09T10:53:11Z |
Thanks for your reply.
I'm referring to doing schema downgrades (like Rails migrations)
outside of Rails ie for use in any DB situation.
There are utilities that compare metadata (including trigger & SP
code) between a source and target DB and produce a difference script.
Normally the source is the new schema and the target is the old
schema, but I guess one could just as easily make the source the old
schema and the target the new schema. This should produce a downgrade
script, although whether it would run successfully on a database
containing data I don't know.
If so, perhaps every time I make an upgrade script I should also make
a downgrade script. Then, in an emergency caused by a complex
unforseen bug which is discovered some time after deployment, I could
always revert customer's DBs if necessary, while fixing the bug.
I think I have answered my own question.
I'm referring to doing schema downgrades (like Rails migrations)
outside of Rails ie for use in any DB situation.
There are utilities that compare metadata (including trigger & SP
code) between a source and target DB and produce a difference script.
Normally the source is the new schema and the target is the old
schema, but I guess one could just as easily make the source the old
schema and the target the new schema. This should produce a downgrade
script, although whether it would run successfully on a database
containing data I don't know.
If so, perhaps every time I make an upgrade script I should also make
a downgrade script. Then, in an emergency caused by a complex
unforseen bug which is discovered some time after deployment, I could
always revert customer's DBs if necessary, while fixing the bug.
I think I have answered my own question.