Undoing database changes, updating various databases etc

May 3, 2013 at 6:56 PM
Hi everybody,

I somehow managed to screw up my database with the same mistake I had made a couple of months earlier, changing the primary key of some entities by hand and not using the refactor rule provided for this purpose. After that I keep getting errors when trying to run the installation scripts.

My question is much more general though:

Is there a recommended procedure for undoing changes? I mean a way to ignore the, let's say, last 5 upgrade scripts and go back to the state of the database (and model) as it was before doing the changes described in those 5 last scripts?

Or if i can put it in a different manner: is there a way to "flatten" all the scripts up to a point and incorporate all the changes they include in a single script that will generate a brand new database?

Along these lines, some advice on distributing database changes to various production installations will be greatly appreciated!

All the best,